I have both nginx v1.15.7 and gitea 1.6.0 running on a Windows 2016 server VM.
It seems as gitea always resolves “localhost” to IPv4 address even though, by default, Windows Server prioritizes IPv6 over IPv4. Nginx resolves “localhost” based on the current Windows prioritization thus preventing the proxy from working.
Gitea config:
[server]
PROTOCOL = https
DOMAIN = localhost.contoso.com
HTTP_ADDR = localhost.contoso.com
HTTP_PORT = 3000
CERT_FILE = C:/Inet/cert/contoso.pem
KEY_FILE = C:/Inet/cert/contoso.pem
ROOT_URL = https://git.contoso.com/
Nginx config:
server {
listen public.contoso.com:443 ssl;
server_name ~(?i)^git\.contoso\.com$;
location / {
proxy_pass https://localhost.contoso.com:3000;
}
}
Contoso DNS server config:
localhost.contoso.com ::1 OK
localhost.contoso.com 127.0.0.1 OK
localhost.contoso.com localhost Nginx proxy returns "upstream timed out"
Is this a gitea bug or is there any way to force gitea to resolve “localhost” according to current host prioritization?