This feels like not an issue with the strip-api-prefixes
middleware not stripping the prefix, but some other issue with the IngressRoute
configuration.
Why? Because, the 404 you are describing: "404 - page not found"
sounds a lot like the Traefik default 404 page, which would mean the web traffic is not even getting to your service.
You should try the port-forward to service again (kubectl port-forward svc/api-golang -n demo-app 8000:8000
) and browsing (or curling) the address with the bad prefix (http://127.0.0.1:8000/api/golang
) and compare the 404 coming back from the app vs the 404 coming back from Traefik. Do they look different? If so, then the 404 with the Traefik port-forward is likely coming from Traefik due to a route issue, and not from your Go pod, because of an unstripped prefix.
There is a bunch of other things to look at that can help troubleshoot this:
kubectl describe
on both your Middleware and IngressRoute objects to look for error messages from the controller:
kubectl describe ingressroute api-golang -n demo-app
kubectl describe middleware strip-api-prefixes -n demo-app
IngressRoute
in its web UI, to see if it shows any errors, to see if it has the Middleware
correctly attached to it, and that it is correctly pointing to your Service
at the expected port.IngressRoute
or Middleware
objects?I would be happy to help out more, but without any error messages from the live objects or the API / ingress pods, I'm just guessing, based on my own Traefik experience.