error-pages
error-pages copied to clipboard
Not found returns 405 if methods are POST/DELETE etc..
Is there an existing issue for this?
- [X] I have searched the existing issues
- [X] And it has nothing to do with Traefik
Describe the bug
When sending regular not found URL with GET method, im getting 404 as usual when sending the same thing with methods other than GET, its returns getting 405
Using ingress-nginx controller And the helm chart configuration & log below:
Steps to reproduce
No response
Configuration files
controller:
config:
custom-http-errors: "400,401,403,404,405,407,408,409,410,411,412,413,416,418,429,500,502,503,504,505"
defaultBackend:
enabled: true
image:
repository: tarampampam/error-pages
tag: "2.20.0"
extraEnvs:
- name: TEMPLATE_NAME # Optional: change the default theme
value: "app-down"
- name: SHOW_DETAILS # Optional: enables the output of additional information on error pages
value: "true"
- name: LOG_FORMAT
value: "json"
### Relevant log output
```shell
This is the log from default backend pod:
[ingress-nginx-defaultbackend-869c98f496-d644d ingress-nginx-default-backend] 2023-02-19T10:26:44.092636417Z {"level":"info","ts":1676802404.092549,"msg":"HTTP request processed","useragent":"PostmanRuntime/7.28.4","method":"POST","url":"/","referer":"","status_code":405,"content_type":"text/plain; charset=utf-8","connection_close":false,"duration":0.000008231,"request_headers":["Host: paa-theruntime.local.platform.test","Content-Length: 243","Content-Type: application/json","User-Agent: PostmanRuntime/7.28.4","Cookie: INGRESSCOOKIE=2ec12f7f26a5b8a4fd603d8b8e5fbd0c|d8628a0b5df4f2b5b6b4858b98a105ce","X-Code: 404","X-Format: */*","X-Original-Uri: /api/runtime/token/v3","X-Request-Id: f4d77e12250191364f9b947e3182d74f","X-Forwarded-For: 192.168.65.4","Accept: */*","Postman-Token: 9d83ccbe-2284-4699-b9ae-42f9eabda61d","Accept-Encoding: gzip, deflate, br","X-Forwarded-Proto: http","X-Envoy-Internal: true","X-B3-Traceid: f5ded2c870cdfe6564cb192bbd092bb9","X-B3-Spanid: 64cb192bbd092bb9","X-B3-Sampled: 1"],"response_headers":["Content-Type: text/plain; charset=utf-8","Allow: GET, OPTIONS"]}
### Anything else?
_No response_
This is not a bug, this is expected behavior. Does this break something on your side?
hi when we make post http request to place that does not exists the response little cobfusing while i guess its returns not found
I understood, thanks for your issue! But the implemented GET method is enough, isn't it?
@tarampampam i guess not, cause its missleading the api consumer if the app returns 405 , its hard to know if its from the app or from default backend
Got the same error when tried to setup WebDAV server. WebDAV clients make PROPFIND HTTP request and instead of 401 error (to understand that they must provide credentials) they receive 405 Method Not Allowed, so they not even trying to provide password and failing.
Temporary solved by removing 401 error from nginx ingress custom-http-errors option.
@tarampampam I would like to see support for all methods here. And depending on the content type, the response is then returned in JSON (as is currently the practice). But answering API requests with 405 instead of the correct - in my case 403 - breaks many applications.
If I request POST /test and /test does not exist, then the response status should be 404 and not 405.
I'm sorry, but I'm currently working on another project, and I have a lot of work at my regular workplace as well. However, when I have some free time, I plan to deeply refactor this project and address most of the issues and requested features. I hope you understand 🙏🏿
Hello everyone! While working on version 3, I added support for any method to request error pages. The third version will be released very soon. I apologize for the long wait and thank you for your patience