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

allow redirect host to be empty #533

Closed
holtwilkins opened this issue Aug 13, 2018 · 3 comments
Closed

allow redirect host to be empty #533

holtwilkins opened this issue Aug 13, 2018 · 3 comments
Milestone

Comments

@holtwilkins
Copy link
Contributor

And use request host if redirect host is empty.

Something like

route add global-redirect :80 https://$path opts "redirect=301"

Was suggested in #455, and I'm filing this ticket in response to that one.

My use-case here is being able to redirect anything received on http to fabio to serve a 301 to the https endpoint of the same address you used to get to fabio in the first place.

Thanks!

@holtwilkins
Copy link
Contributor Author

Hey @leprechau & @magiconair , I started working on this, and did something similar to https://github.com/fabiolb/fabio/pull/451/files to get the $host substitution going.

However, the issue I'm seeing now is that the :80 part doesn't seem to work. I.e. route add mock :80/ https://a.com/ opts "redirect=301" doesn't work, but route add mock a.com:80/ https://a.com/ opts "redirect=301" does. So, it seems like a / as the source is fine, but if you throw a port in there, it's no longer a catch-all. Ideas on how to rectify that part (other than just run a separate instance of fabio that has a single / rule)?

@holtwilkins
Copy link
Contributor Author

Hey @leprechau & @magiconair , I figured out the missing bit, it was this line: https://github.com/fabiolb/fabio/pull/544/files#diff-416b5689da1c2696679b73504589fad3R362

Now this global http -> https redirect seems to work great, what do you think?

@aaronhurt
Copy link
Member

@holtwilkins Sorry, just getting caught back up on things. I'll try and get this reviewed soon.

@magiconair magiconair added this to the 1.5.10 milestone Sep 19, 2018
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

3 participants