asuswrt-merlin
asuswrt-merlin copied to clipboard
webui: Add option to redirect to HTTPS
Adds an option to force HTTPS for the webui.
why not 301 status?
It was already a JS redirect, I tried to change as little as possible.
Just redirecting won't be enough, since the https port might not be 443. This will have to be taken into consideration.
Also, I would prefer a radio button rather than a checkbox on the webui, to be in-like with the rest of the UI.
Wouldn't handling this in httpd.c as a 301 actually reduce the amount of changes required (as do_ssl wouldn't need to be moved for instance)? I was thinking of possibly handle_request() as a potential location.
Hrm, I thought I included the port.. maybe I committed the wrong version.
I can change it to a radio and look at doing it in handle_request() as a 302 (301 is a permanent redirect so if SSL is disabled or port is changed, browser cache will need clearing as it won't recheck it).
302 might possibly be better indeed in this case, although when I configure a customer's website to redirect http to https through mod_rewrite, I always used a 301, as 302 seem to imply that it's expected to eventually no longer redirect.