Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 request to Federation Port are forwarded to the docker container as IPv6 (external nginx) #1914

Closed
JokerGermany opened this issue Jul 2, 2022 · 1 comment

Comments

@JokerGermany
Copy link
Contributor

JokerGermany commented Jul 2, 2022

This is the error

2022/07/01 14:29:00 [error] 27625#27625: *328278 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /_matrix/federation/v1/query/profile?user_id=%40_discordpuppet__465226356335050754%3Aexample2.com&field=avatar_url HTTP/1.0", upstream: "http://[::1]:8048/_matrix/federation/v1/query/profile?user_id=%40_discordpuppet__465226356335050754%3Aexample2.com&field=avatar_url", host: "matrix.example2.com"

The problem is this file:
/matrix/nginx-proxy/conf.d/matrix-synapse.conf


server {
        listen 12080;

        server_tokens off;
        root /dev/null;

        gzip on;
        gzip_types text/plain application/json;




        location / {
                        proxy_pass http://127.0.0.1:8008;

                proxy_set_header Host $host;

                client_body_buffer_size 25M;
                client_max_body_size 50M;
                proxy_max_temp_file_size 0;
        }
}

server {
        listen 12088;

        server_tokens off;

        root /dev/null;

        gzip on;
        gzip_types text/plain application/json;


        location / {
                        proxy_pass http://localhost:8048;

                proxy_set_header Host $host;

                client_body_buffer_size 25M;
                client_max_body_size 150M;
                proxy_max_temp_file_size 0;
        }
}

When I edit proxy_pass http://localhost:8048; into proxy_pass http://127.0.0.1:8048; the error vanished.
I try to fix this problem myself in the playbook, but i ended up at line 196 proxy_pass http://media_repository_upstream$request_uri; in /matrix-docker-ansible-deploy/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2
This leads to localhost and this produce problems with ipv6 request and therefore needs to be changed to 127.0.0.1
But i don't know how media_repository_upstream$request_uri is created...

@JokerGermany JokerGermany changed the title IPv6 request to Federation Port are forwarded tot he docker container as IPv4 (external nginx) IPv6 request to Federation Port are forwarded to the docker container as IPv6 (external nginx) Jul 2, 2022
@spantaleev
Copy link
Owner

Fixed in 2e4fad6.


http://media_repository_upstream is one of the media repository worker addresses, defined in the upstream media_repository_upstream configuration clause.

These are made to go to 127.0.0.1:{{ worker.port }} when nginx is disabled, or to the specific matrix-synapse-worker-{{ worker.type }}-{{ worker.instanceId }}:{{ worker.port }} media worker container otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants