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

Catch all redirect #451

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Catch all redirect #451

wants to merge 2 commits into from

Conversation

magiconair
Copy link
Contributor

This patch adds the option to redirect to the same host but maybe on a different path or scheme.

For this $host can be used on the target URL, e.g.

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

This patch adds the option to redirect to the same host
but maybe on a different path or scheme.
@magiconair
Copy link
Contributor Author

Hmm, not sure whether this creates a redirect loop.

@aaronhurt
Copy link
Member

aaronhurt commented Feb 26, 2018

If we interpret that https-redirect as only valid for originating http that should be redirected to https I think this works. Meaning that https-redirect will never match an incoming https request.

Otherwise we could keep the same http-redirect with the additional $host pseudo var and restrict on port in the rule something like...

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

@aaronhurt
Copy link
Member

Sorry, just looked at the code ... there's not a new option it is just adding the pseudo var. So I think that you would get a redirect loop with a path / match but shouldn't with a port :80 match.

@magiconair
Copy link
Contributor Author

Something like route add :80/ ... might be handy. Not sure if that fits well with the current syntax

@aaronhurt
Copy link
Member

Agreed a host agnostic match with a port and path is exactly what you would want for this specific use case.

@holtwilkins holtwilkins mentioned this pull request Jul 9, 2018
@holtwilkins
Copy link
Contributor

How about #544 instead?

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

Successfully merging this pull request may close these issues.

None yet

3 participants