Proxy port 80 to 443 with Netcat/nc

cygwinhttpredirectruby-on-railsthin

I have a Windows server running a Rails application via the Thin ruby gem web server through Cygwin 32 bit. The server only listens on port 443 and uses HTTPS because it is using LDAP authentication and I did not want to have plain text passwords on the wire. I would like to have a super simple, down and dirty proxy to redirect http to https. Can this be achieved via nc or some other cygwin tool without having to install something like squid or apache?

Best Answer

Theoretically, nc can take traffic on port 80 and ship it off to port 443.

However, that's not going to work for you.

You need a reverse proxy like nginx, apache, or other HTTP-aware bit that can do an HTTP-level redirect to instruct the browser to connect using HTTPS. nc can't operate at that level. Heck, you could even start up a very simple ruby app that listens on port 80 and does the redirect for you.