if I am running apache service in the server behind the proxy as www.bar.com and want to server its content as www.foo.com/bar/
will the following will rewrite the route if I add stripPrefix OR should I have to do with a sidecar in this case. This works if the service is running in the same docker server as traefik is running. However, it does not work for external servers. I receive 404 error from traefik.
www.foo.com/bar/product/abc should proxy www.bar.com/product/abc
[http.middlewares]
[http.middlewares.admin-stripprefix.stripPrefix]
prefixes = ["/bar"]
[http.routers]
[http.routers.Router-1]
rule = "Host(`www.foo.com`) && Path(`/bar`)"
service = "my-service"
# will terminate the TLS request
[http.routers.Router-1.tls]
[http.services]
[http.services.my-service.loadBalancer]
[[http.services.my-service.loadBalancer.servers]]
url = "https://www.bar.com/"
traefik labels:
labels:
- traefik.serversTransport.insecureSkipVerify=true
- traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)
- traefik.http.routers.http-catchall.entrypoints=web
- traefik.http.routers.http-catchall.middlewares=redirecttohttps@docker
- traefik.http.middlewares.redirecttohttps.redirectscheme.scheme=https
- traefik.http.middlewares.redirecttohttps.redirectscheme.port=443
- traefik.http.middlewares.redirecttohttps.redirectscheme.permanent=true
- traefik.http.routers.traefikapi.rule=Host(`www.mytraffic.com`)
- traefik.http.routers.traefikapi.service=api@internal
- traefik.http.routers.traefikapi.tls=true
- traefik.http.routers.traefikapi.middlewares=redirecttohttps
a working service as a docker container:
labels:
- traefik.http.middlewares.testnodejsappapiprefix.stripprefix.prefixes=/testnode
- traefik.http.middlewares.testnodejsappapiprefix.stripprefix.forceslash=false
- traefik.enable=true
- traefik.http.routers.testnodejsappapi.entrypoints=websecure
- traefik.http.routers.testnodejsappapi.tls=true
- traefik.http.routers.testnodejsappapi.rule=Host(`www.foo.com`) && PathPrefix(`/testnode`)
- traefik.http.routers.testnodejsappapi.middlewares=redirecttohttps,testnodejsappapiprefix
- traefik.http.routers.testnodejsappapi.middlewares=testnodejsappapiprefix