Is this the intended method of achieving a proxy pass? Every time I hit the localhost/tip path I get a 404. Any help would be appreciated
[http.routers]
[http.routers.tip-router]
rule = "Host(`localhost`) && PathPrefix(`/tip`)"
service = "tip-service"
middlewares = "tip-strip"
[http.middlewares]
[http.middlewares.tip-strip.stripprefix]
prefixes = ["/tip"]
[http.services]
[http.services.my-service.loadBalancer.servers]
url = "http://google.com"
ldez
2
Hello,
there are some errors in your configuration: middlewares
and servers
are list.
[http.routers]
[http.routers.tip-router]
rule = "Host(`localhost`) && PathPrefix(`/tip`)"
service = "tip-service"
middlewares = ["tip-strip"]
[http.middlewares]
[http.middlewares.tip-strip.stripPrefix]
prefixes = ["/tip"]
[http.services]
[[http.services.my-service.loadBalancer.servers]]
url = "http://google.com"
@ldez I fixed it as suggested, still getting a 404 at https://localhost/tip
ldez
4
There is a typo is the service name:
[http.routers]
[http.routers.tip-router]
rule = "Host(`localhost`) && PathPrefix(`/tip`)"
service = "tip-service"
middlewares = ["tip-strip"]
[http.middlewares]
[http.middlewares.tip-strip.stripPrefix]
prefixes = ["/tip"]
[http.services]
[[http.services.tip-service.loadBalancer.servers]]
url = "http://google.com"
Are there other factors that might be causing this? Or is this feature not meant to be used in this way
Looks like I figured it out, needed a dynamic conf file provider, and to terminate the tls on the router as I was using https.
In traefik.toml:
[providers]
[providers.docker]
[providers.file]
filename = "/etc/traefik/dynamic_conf.toml"
watch = true
In dynamic_conf.toml
[http.middlewares]
[http.middlewares.tip-strip.stripPrefix]
prefixes = ["/tip"]
[http.routers]
[http.routers.tip-router]
rule = "Host(`my.domain`) && PathPrefix(`/tip`)"
service = "tip-service"
middlewares = ["tip-strip"]
[http.routers.tip-router.tls]
[http.services]
[[http.services.tip-service.loadBalancer.servers]]
url = "http://google.com"