Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect from http to https #127

Open
zevero opened this issue May 20, 2017 · 4 comments
Open

Redirect from http to https #127

zevero opened this issue May 20, 2017 · 4 comments

Comments

@zevero
Copy link
Contributor

zevero commented May 20, 2017

Hi,
I am trying to redirect a subdomain from http to https very similar to the example given in readme.

80: {
  router: {
    "sub.atlashost.eu": "https://sub.atlashost.eu/[path]",
    "*": 8080
  }
}, 
443: {
  router: {
    "sub.atlashost.eu":    4500
  },
  ssl: {
    letsencrypt: true,
    spdy: true
  }  
}    

this is working for any path, but root is NOT redirected and I am getting 404 Not Found instead.

As I only need a redirect to the root I tried (with and without trailing "/" )

"sub.atlashost.eu": "https://sub.atlashost.eu",

but now there is NO redirect and http - request are just going through ... to port 4500 although it is not mentioned in the upper section!!

I am doing sudo systemctl restart http-master after each change and restarting my express app does not help either. I even did reboot my entire server. I tried to disable spdy as well.

@zevero
Copy link
Contributor Author

zevero commented May 20, 2017

Some more testing revealed, that [path] seems just not working at all ... I think it was chrome which redirected me to https if not root. If explicitly started with http:// I get 404 Not Found again.

And it seems that without [path] I am forwarded instead of redirected ...

@zevero
Copy link
Contributor Author

zevero commented May 20, 2017

Uh ... finally I found the redirect -> syntax. Everything is working now!

I guess without redirect -> it is just forwarding? If so I'd like to improve documentation on this point...

@Rush
Copy link
Member

Rush commented May 21, 2017

I guess without redirect -> it is just forwarding? If so I'd like to improve documentation on this point...

That's right! Initials versions of http-master had a separate forwarding/routing mapping but at one point I decided there should be only one mapping table per port with forwarding/routing as the default behavior and other behaviors as modules invoked with moduleName -> target - in this case "redirect -> https://something`.

I would appreciate any PR for documentation you deem necessary to make it better.

If you think that redirect could be achieved in a simpler way please let me know too.

@Rush
Copy link
Member

Rush commented May 21, 2017

but now there is NO redirect and http - request are just going through ... to port 4500 although it is not mentioned in the upper section!!

This is quite funny :) You set up forwarding from sub.atlashost.eu:80 to sub.atlashost.eu:443 and then to localhost:4500. I never considered such usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants