Skip to content

nginx.conf assumes localhost, may fail on ipv4/ipv6 selection #2299

@grinapo

Description

@grinapo

Description

I noticed that nginx reports random Connection refuseds. Took a while to figure out:

My server is bound to ipv6 ([::1]), and the nginx config uses localhost for proxy_pass, which by default resolves to ::1, but sometimes (this may be related to server not responding fast enough up to about anything, I haven't debugged that part) it resolved to 127.0.0.1, which failed to connect.

I have defined $local_host set to '[::1]`, replaced all "localhost" refreences and the problems went away. You may or may not want to do the same.

Steps to reproduce

  1. bind server to ::1 only
  2. let localhost resolve preferece to ipv6
  3. occasionally you may see connection fail to 127.0.0.1

Relevant logs

Expected behavior

No connection refused is nice. 😁

(sidenote, 2026.5 is not selectable version in this bug template!)

Which operating system are you using?

Linux/BSD/UNIX

What browsers are you seeing the problem on?

Mozilla Firefox

Extensions

NA

Version

Other

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions