rejetto forum

redirection : http:\\ en https:\\

0 Members and 1 Guest are viewing this topic.

Offline jbckylie

  • Occasional poster
  • *
    • Posts: 3
    • View Profile
i have a question:
how can i do to have an automatic redirection from http to https.

My config:
wrt54g with port 80 to a pc in

hfs on port 80

stunnel on port 443.

If i do https:\\ , it's ok : stunnel+hfs = hfs secure

I just want : a guy which type http:\\aaaa.aa is automaticaly routed to https\\ via stunnel+hsf.

Thanks you.

Offline ~GeeS~

  • Tireless poster
  • ****
    • Posts: 270
  • "The web was made for sharing..."
    • View Profile
One possible solution could be (had no time to test it myself, is still on my To-Do list):

- Run 2 instances of HFS (go to Menu:Start/Exit:Only 1 instance, uncheck) or do you want to do to this on more than 1 machine?

- Run the first instance of HFS listening on port 80 (portforwarding on your router enabled for port 80)

- First HFS serves only one webpage with a redirect to
Code: [Select]
<meta http-equiv="refresh" content="0;URL=" />
- Run STunnel listening on port 443 (portforwarding on your router enabled for port 443)

- Run a second instance of HFS (with your filesystem) on port 65080 (or any other unused free port)

- Forward STunnel to port 65080 or accordingly (portforwarding on your router disabled for port 65080 or accordingly)

Requests for (http://) (first HFS with webpage only) will be redirected to (Stunnel) and from there to the second instance of HFS with your filesystem.
Because the port of the second instance of HFS with your filesytem is not forwarded in your router, http from the outside of your LAN is not possible; it can be approached only by https/ssl thru STunnel.
Requests for would go directly thru STunnel to your second instance of HFS with your filesystem.

Remark: Without a router this could be achieved also. But if a visitor knows/finds/guesses the port of your second instance of HFS with your fileserver, it could be approached unsecure with

Or as a diagram:
browser  -http-->    80:router -http---->  80:HFS_1(webpage) <browser redirected to: https:443 by HTML>

   browser  -https->   443:router -https---> 443:STunnel ----http-> 65080:HFS_2(filesystem)
   browser  -http--> 65080:router -blocked-|

Good luck! Hope it works!

PS. If somebody has some suggestions/experience on combining Proxomitron/Stunnel/HFS for (ssl-)proxying ... you're very welcome.

Offline maverick

  • Tireless poster
  • ****
    • Posts: 1052
  • Computer Solutions
    • View Profile

If you don't really need re-direction from http to https,  go directly to https
 --> therefore the starting address would be -->

In HFS, restrict access to all accounts in the vfs root. (right click on /)

In your firewall, deny access for HFS to the internet, but grant acccess for  STunnel to the internet. People are then forced to only use https while visiting your site.  Any http attempt will be blocked.

Tested and works fine and you don't have to play around with your router.