|
There isn't a close method, once you call server.listen(...) that's it, in
Windows it's ended with Ctrl-C. The simplified code is below, lifted from
the examples:
var http = require('http'),
httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer({"changeOrigin": true});
var server = http.createServer(function(req, res) {
// You can define here your custom logic to handle the request
// and then proxy the request.
proxy.web(req, res, { target: 'http://ger400-d:13482' });
});
console.log("listening on port 5052")
server.listen(5052);
Tim
________________________________
From: WEB400 <web400-bounces@xxxxxxxxxxxx> on behalf of Kevin Turner <
kevin.turner@xxxxxxxxxxxxxx>
Sent: 15 March 2017 14:03
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] NodeJs hung ports
Presumably you are calling the "close" method when you want to end? If
you are just killing the shell then you need to trap that and close the
connection gracefully - but preferably have a cleaner way of terminating.
[https://www.netcracker.com/assets/img/netcracker-social-final.png] ƕ
-----Original Message-----
From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Tim Fathers
Sent: 15 March 2017 09:34
To: web400@xxxxxxxxxxxx
Subject: [WEB400] Fw: NodeJs hung ports
Hi all,
I'm trying to create a simple reverse proxy to front our application
servers using this https://www.npmjs.com/package/http-proxy but I'm
finding that after I execute it through the QP2TERM shell the port number
is still in use after the shell session ends. Netstat shows no jobs or
tasks associated with the port, but it does show my user profile as being
the associated user. Is there a) a way to prevent this happening, b) a way
to forcibly free the ports that appear to be hung?
Many thanksm
Tim.
[https://www.npmjs.com/static/images/touch-icons/open-graph.png]<
https://www.npmjs.com/package/http-proxy>
http-proxy - npm<https://www.npmjs.com/package/http-proxy>
www.npmjs.com<http://www.npmjs.com>
node-http-proxy node-http-proxy is an HTTP programmable proxying library
that supports websockets. It is suitable for implementing components such
as reverse proxies ...
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list To post a message email: WEB400@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.
________________________________
The information transmitted herein is intended only for the person or
entity to which it is addressed and may contain confidential, proprietary
and/or privileged material. Any review, retransmission, dissemination or
other use of, or taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the material
from any computer.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
[https://www.netcracker.com/assets/img/netcracker-social-final.png]
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.