Listen to Unix socket instead of localhost:9000

When using a dual-stack server, ‘localhost’ is ambiguous, it can be (IPv4) or ::1 (IPv6). Specifying localhost in production.yaml gets interpreted as the v4 address, but the resolver used by nginx gets the v6 address first, leading to lots of errors like this one:

[error] 22446#22446: *29 connect() failed (111: Connection r
efused) while connecting to upstream, client: 2a03:7220:8081:6101::18, server: p, request: “POST /api/v1/users/token HTTP/2.0”, upstream: “http:/
/[::1]:9000/api/v1/users/token”, host: “”, referrer: “https://pe

One good way to avoid the problem (and probably more efficient too) would be to use a Unix socket rather than an IP one. Afaict, nginx supports this.
Would it be possible to tell peertube toblisten to a Unix socket, by specifying a path rather than a host name for instance ?


No sorry it’s not possible. Could you create an issue?

And can’t you just put the IP address directly in nginx instead of localhost?

Yes, for now I’ve put the IP address in the configuration to fix the issue. It works great.
I’ve opened issue #1951