I've setup my nginx proxy to pass mail as well.
However, when it comes to authenticating I get puzzling errors. The auth script on the backend server returns the following headers:
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 30 Jul 2022 04:09:00 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Auth-Status: OK
Auth-Server: 192.168.1.32
Auth-Port: 110
X-Frame-Options: sameorigin
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
Content-Security-Policy: default-src https: data: 'unsafe-inline' 'unsafe-eval'
Referrer-Policy: strict-origin
but when I connect to the nginx pop3 port for testing I get
-ERR internal server error
Connection closed by foreign host.
Digging through logs and putting lots of debugging on my backend script - its not occurring on the backend. There is also nothing in the local nginx error logs.
One thing I have noticed is after the USER and PASS sequence (which, on the backend, gets a successful authentication), the session hangs for a significant time before throwing the error. Nothing seems to be mentioned by nginx docs, but is there something else that needs to be sent after sending the headers?
Currently, the pass function (PHP) is
function pass($server, $port) {
header("Auth-Status: OK");
header("Auth-Server: $server");
header("Auth-Port: $port");
flush();
die();
}
CodePudding user response:
OK, I fell victim to useless error codes..
What had happened is that I had not opened the pop3 port between my proxy and the mail server.. of course, nginx didn't tell me that; it just threw a 500 error..
For the next person - if everything seems to be working, but you get a 500 error on the mail proxy - check if you can connect to the server/port your auth script returns