liftoff / GateOne

Gate One is an HTML5-powered terminal emulator and SSH client
http://liftoffsoftware.com/Products/GateOne
Other
6.28k stars 925 forks source link

redirect http acces to https #68

Closed koenkooi closed 13 years ago

koenkooi commented 13 years ago

I'd like to advertise gateone through dns-sd (bonjour in apple speak) and I've run into a snag: dns-sd only support announcing http services: http://www.dns-sd.org/ServiceTypes.html

It would be awesome if gateone would respond to http requests with a redirect to the https:// address as recommended in the dns-sd document mentioned above.

liftoff commented 13 years ago

This is a good idea regardless of dns-sd. I'll see if I can get it working. At the very least I could spawn a separate listener thread that performs the redirect. Thanks for this.

liftoff commented 13 years ago

I just pushed a commit that added a new option: https_redirect... Use it like so:

./gateone.py --https_redirect=True

This will tell Gate One to start up a listener on port 80 that redirects clients to HTTPS on Gate One's configured port.

I wanted to have it redirect HTTP to HTTPS on the same port but I couldn't get that to work due to the nature of the Tornado framework (I'd have to override a ton of stuff which would cause issues for forward compatibility).

Anyway, let me know if this solves your issue with dns-sd. Thanks

koenkooi commented 13 years ago

I haven't tested it yet, but it would indeed solve the dns-sd problem, thanks!

Gwindalmir commented 13 years ago

Just to add a comment (not about dns-sd): I'd like the redirect ability as well (but not as important), however I already have a web server on port 80, so the https_redirect option won't work for me. Plus, I always remember to type the port number (mines different anyway, since I also have an SSL port open for my webserver. I just sometimes forget the 'https' part. I realize the issue with tornado, so it's more just a feature request. :-)

liftoff commented 13 years ago

Yeah, I really wish Tornado supported redirecting non-HTTPS requests to HTTPS but it just doesn't. It is all handled in the IOStream which is about three degrees of separation from the level at which Gate One operates. I could override the behavior but I'd have to override RequestHandler, HTTPRequest, and the IOStream itself. It would get real ugly.