Slightly more verbose way to ask: Is there any way to make Traefik not forward HTTP -> HTTPS for a specific URL, only (while continuing to forward the rest to HTTPS)?
I'm going to switch from nginx if I can do this on traefik. Do you know if it is possible? And if so, then how? I've been trying with nginx here:
I saw told by your GitHub bot to ask here in the forum instead:
10:07PM - 04 Nov 19 UTC
02:38AM - 05 Nov 19 UTC
Slightly more verbose way to ask: Is there any way to make Traefik not forward HTTP -> HTTPS for a specific...
yes it's possible.
Just need to create a router with an entry point on the port 80 and set a priority if needed.
It's hard to say more without any concrete context.
(post withdrawn by author, will be automatically deleted in 1 hour unless flagged)
letsencrypt can me managed by traefik it-self
Is there a traefik docker-compose.yml you recommend that is widely used and supported?
Not many seem to be using traefik-library-image (on github) in comparison to jwilder's nginx-proxy - any idea why? Maybe the primary recommendation for traefik is not to run in docker, but on the host? Also, do you know the equivalent of VIRTUAL_HOST= thedomainname.com for traefik? It makes it quite easy & nice to run multiple webserver on the same host within containers.
@TrafikJam, first of all, Traefik has an official Docker image, which the recommended way to run it when using Docker. You can find more on the documentation: https://docs.traefik.io/v2.0/getting-started/install-traefik/#use-the-official-docker-image . The Github repository you mention,
traefik-library-image is absolutely not aimed to be used by end users: it's the source of truth for the official Docker Image.
There is no
docker-compose.yml that would work out of the box for you, as the context is different for each user. You strongly should take time to read the blog post mentioned earlier, and/or the official documentation to fully understand how it works.
OK, mostly done switching over to Traefik from Nginx. Now how do I rewrite
http://mydomain.com/specificURL1 from container A, to https://service.mydomain.com/specificURL2 which is in container B?
The solution must be compatible with:
# global redirect to https
# middleware redirect
which is working well for me overall.
EDIT: to be extra clear - this needs to be a rewrite, only server-side, not client side, will work.
OK, I put in another few hours trying to figure this out. I see the POST on the URL, but it doesn't make its way to the right services somehow. I've tried using internal container@docker and also external URLs as the 'traefik.http.middlewares.old.replacepathregex.replacement='.
I've tried these as labels in the service running "
http://www.domain.com/oldURL" the service running " http://services.domain.com/new" - and also both simultaneously. I've also tried it in the global config... And it does still seem like I would have to disable the global HTTPS redirect.
@dduportal @ldez Is there any way to pay for support on this issue? It is really holding me up.
Turns out I cannot afford TraefikEE for $5k/yr
I'm testing some router priority settings now...
It seems the request does not get to the right container. The URL POSTs, but not on the right container@docker. It says "-" instead.
Pretty disappointed about this. I thought the forum would have more than one or two people capable of answering such questions. I regret the time switching from nginx to traefik not realizing traefik refuses to even clarify terminology about its functionality. And directed to get support for way more than I can afford... Of course with no guarantee the problem would get solved.
EDIT: I have figured out the nginx config that I want to translate into traffic terms.
the solution of the initial issue (skip the rediection for a specific URL) is here:
set a low priority on the global redirect.
then set a high priority on the "HTTP only" router
It doesn't work. I get 200s but the service never receives it.
How can I receive on HTTP by a backend service running on HTTPS, and then have it answer on HTTP again?
If you provide more concrete context (docker-compose file), the answer will be more precise.
# global redirect to https
# traefik.http.routers.http-catchall.priority: 1
Sure, and I can paste the entire compose file if needed:
https://services.URL.com/456" does not receive the POST sent to " http://www.URL.com/path/123" - however, I see a 200 in Traefik.
Also, this will not allow " https://services.URL.com/456" to reply to the remote without SSL.
So Traefik needs to sit between it and the remote and remove the SSL somehow.
This is not the only app in the compose file. Another app listens on
www.URL.com & URL.com, but I'm not sure if that matters (I tried this replacepath as a label on both apps, either app, and also globally under traefik app).
@ldez I hope that's enough info
The router is on
services.URL.com so it will never catch
You have to create a router that match the host
Sorry but what you are trying to do is not clear.
So I will give you an example related to what I understand.
I renamed the elements in your sample, because uses the name
services for everything is a really confusing.
Also you don't need to export the port
# router for services.URL.com on the entrypoint websecure
# router for http://www.URL.com on the entrypoint web, always redirect.
# https://www.URL.com/path/123 -> https://services.URL.com/456
- "traefik.http.routers.app_redirect.rule=Host(`www.URL.com`) && PathPrefix(`/path/123`)"
# Middlewares defintions