-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Add option to force www addition or removal #1380
Comments
Could the |
I don't think so, we're talking about the host name, not the path. |
@yajo true, you're right. |
- Do not add the `X-Forwarded-*` headers because the previous Traefik proxy should be adding them, and we don't want to override them. - By default, as a good SEO rule of thumb, we only want to expose Odoo in a single host name, forcing all other hosts to get redirected to the main one, so we add the `FORCEHOST` support for the middle proxy. We won't need this after traefik/traefik#1380 is fixed and released.
Related to #919 |
Related feature request #572 - closed with suggestion of Workaround#2. |
I think they closed it because it was just a question, but this is a feature request and it's still open, so it's ok if I understood correctly. 🙄 |
I have started to work on a solution to add a custom redirect feature per frontend, to be able to specify a virtual frontend and backend just for the matter of redirection from one domain to another one being able to specify the domain name as a regexp to match the domain name. [backends]
[backends.aek-http]
[backends.aek]
[backends.aek.servers.instance]
url = "http://127.0.0.1:8069"
[frontends]
[frontends.aek-http]
redirectRegex = "(http://mio.aek)"
redirectReplacement = "https://www.mio.aek"
backend = "aek-http"
[frontends.aek]
backend = "aek"
passHostHeader = true
entrypoints = ["http"]
[frontends.aek.routes.instance]
rule = "Host:aek.localhost" Also this allow to specify:
It's working with the redirection features, I could submit a pull request if this is the way it should work with traefik, perhaps there is a better way, but i'm new to traefik and golang and this is the better way that I figure out from the traefik source code. |
Closed by #2570. |
What version of Traefik are you using (
traefik version
)?Version: v1.2.1
Codename: morbier
Go version: go1.7.5
Built: 2017-03-27_03:19:40PM
OS/Arch: linux/amd64
What is your environment & configuration (arguments, toml...)?
Docker, no swarm:
What did you do?
I wanted to redirect
www.example.com
toexample.com
in a website running behind Traefik. I wanted to do the opposite (example.org
towww.example.org
) in another website.What did you expect to see?
I expected frontends to let you have a list of alternative host names a main one that gets all of those redirected, so I could do something like this in my
docker-compose.yaml
:ACME should get certs for all of them.
Given this situation of
www.
removal or addition is so common (I had to do that on almost every website I ever launched in my life), maybe a shortcut flag would be useful:However, first option is more flexible indeed.
What did you see instead?
Traefik cannot redirect by frontend, just by entrypoint. This reminds me to #1346.
Possible workarounds
www.example.com
and just returns a 301 redirection toexample.com
. Do the same forexample.org
. This would be more maintainable than previous workaround, but it seems a little bit absurd.The text was updated successfully, but these errors were encountered: