Handling missing pages #140
-
Is there a way to handle missing pages with some variable ? The issue is, when the endpoint/service does not exist in Traefik it will correctly return 404 nice images because it will go for 'query: /{status}.html' so 404.html from container error-pages. Eg when call http://page.not.setup.com But when I call http://page.not.setup.com/something I get basically redirected to /something on Basically, I need this part of code: https://github.com/tarampampam/error-pages/blob/e2489a24879586bd087b2de0a091cd1723c7f00e/internal/http/handlers/notfound/handler.go To redirect to 404.html, unfortunately I don't know |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
It looks like there is something wrong with the trarfik settings. Could you please attach your config? |
Beta Was this translation helpful? Give feedback.
-
Sure. It might be actually issue with Traefik, I would assume that I need some kind of middleware that redirects not found pages to 404.html... I have it setup like this: Deployment
Service:
Ingress
Ingress is setup to match any hostname that was not matched by anything else, thus the low priority, Middleware
Now when I have another ingress
As of that it works fine. However when I edit the ingress for argocd and change the port to 81, which makes it not reachable. I get to 'some.domain.com' and get nice 404 from the error-pages container... however if I enter `some.domain.com/something' or 'some.domain.com/somehting.html' this get passed to the error-pages container and of course these endpoints does not exist there. Thus the message from my initial message. Maybe I'm doing it wrong ? I know that If I map the middleware to the ingress for argocd it self then it should work ok ( did not test yet), but what about described situation above... ? It could be solved if the error-pages http server it self refer to its own 404.html when page is not found on it... |
Beta Was this translation helpful? Give feedback.
-
Hmm thinking about it now, I should probably add:
To the |
Beta Was this translation helpful? Give feedback.
Hmm thinking about it now,
I should probably add:
To the
catch all
ingress route, so it can reference it self with error codes...