Closed iivanov9 closed 2 years ago
@iivanov9 do you see in the access logs which status cod is returned form fakesmtp server?
Here is an error message from container logs: fakesmtp_1 | 2022-06-09 18:49:47.198 WARN 1 --- [-nio-443-exec-7] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported]
@iivanov9 Please try to add spring.mvc.hiddenmethod.filter.enabled=true to your application.properties.
@cbrien: Thanks for jumping in.
We run fake-smtp in docker on a devel server with public IP. We use nginx as a reverse proxy with basic auth and https enabled. Everything works fine except one problem - when user press "Delete" button, fake-smtp returns 405 error: Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Wed Jun 08 07:55:20 GMT 2022 There was an unexpected error (type=Method Not Allowed, status=405).
And docker logs for this container shows an error: WARN 7 --- [-nio-443-exec-9] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported]
When fake-smtp runs locally everything works fine. User request simulation with curl. Behind nginx:
curl -v -d "_method=delete&_method=delete" -u "user:pass" -H "Content-Type: application/x-www-form-urlencoded" -X POST https://devel-serv/email/50
Response headers: < HTTP/1.1 405 < Server: nginx/1.16.1 < Date: Tue, 07 Jun 2022 15:32:41 GMT < Content-Type: application/json < Transfer-Encoding: chunked < Connection: keep-alive < Allow: DELETE, GETLocally:
curl -v -d "_method=delete&_method=delete" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://127.0.0.1:5080/email/3
Response headers: < HTTP/1.1 302 < Location: http://127.0.0.1:5080/email < Content-Language: en-US < Content-Length: 0 < Date: Tue, 07 Jun 2022 15:19:07 GMTNginx config: _upstream smtp { server 127.0.0.1:8280; keepalive 100; } location / { proxy_pass_request_headers on; proxy_set_header Host $host; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_pass http://smtp; auth_basic "Fake SMTP"; auth_basic_userfile /etc/nginx/auth/.htpasswd; }