Or better yet, redirect :80 to https://yourserver.com and wholly avoid
mixed secure/insecure code paths.
// a simple listener to redirect 80 to https
http.createServer(function (req, res) {
res.writeHead(301, {Location: https://; + HOST + req.url});
res.end();
}).listen(80);
On
But then, integrating the custom protocol might not be possible right? The
custom protocol is used for admin purposes. This is currently a python
codebase. We are porting it to nodejs. So the client wants to keep the
architecture same.
On Wednesday, 6 February 2013 19:04:11 UTC-8,
A long time ago I built a proof of concept for something like
this: https://github.com/bmeck/kitsune
After thinking about maintainability I decided to avoid doing this sort of
behavior but left the code up as an example.
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
Why would you want to do this?
Why wouldn't you want http on :80 and https on :443, so that you have
https://yourserver.com and http://yourserver.com instead of
http://blah.com and https://blah.com:80/ which looks funny and
strange?
Do something like this:
http.createServer(handler).listen(80);
Ok. Let me rephrase the question:
I am inside connectionHandler of net.createServer. Now when I determine the
data from client is HTTP request, I want to convert it to HTTPRequest
object so that I can leverage the HTTP headers, status code parsing etc.
It is some client requirement where the