My node app is receiving some mysterious CONNECT requests and I'm trying to get to the bottom of where these are coming from (see separate post here).
I'm using the express module and until now, incoming CONNECT requests would just be fended off automatically with a 503 response.
But now, in order to examine the headers of these CONNECT requests, I'm trying to implement handling of such requests using the express module, if only just to dump the headers to the console and then send a 503 response myself.
Given the express seems to provide handling of connect as well as get and post (see here), this is what I've tried so far:
var connectHandler = function(req, res) {
console.log(JSON.stringify(req.headers));
res.sendStatus(503);
};
var app = express();
app.connect('*', connectHandler);
But the behaviour of the node app doesn't change... i.e. nothing is dumped to console when an incoming CONNECT request is received, with the CONNECT request being fended off and with the following entry in the log (just as before):
Oct 27 14:14:25 example heroku/router: at=error code=H13 desc="Connection closed without response" method=CONNECT path="example.herokuapp.com:443" host=example.herokuapp.com request_id=353e623x-dec4-42x5-bcfb-452add02ecef fwd="111.22.333.4" dyno=web.1 connect=0ms service=1ms status=503 bytes=0
Any help appreciated.