Nginx-proxy-manager: IPv6 not supported

Created on 24 May 2019  Â·  8Comments  Â·  Source: jc21/nginx-proxy-manager

Describe the bug

  • Seems like IPv6 is not supported.
  • Versions used: Latests

To Reproduce
Steps to reproduce the behavior:
1. Enable IPv6 for docker:
- Create a network at docker with the following command:
$ docker network create --subnet 2a02::/80 --ipv6 network_name
Replace 2a02:: with the IPv6 block given by your ISP, or, in case you don't have IPv6 support use a block reserved for NAT, (for example: fe80:10::/80). I will use 2a02:10::/80 in this example.

  1. Create the dockers:
  2. Create the docker of mariadb inside that network:
    $ docker pull mariadb
    $ docker create --name=mariadb -e MYSQL_ROOT_PASSWORD=your_password -v ~/docker_data/mariadb:/var/lib/mysql --network network_name --ip6 2a02:10::10 mariadb
    $ docker start mariadb
  3. Create a database called nginx:
    $ docker run -it --network network_name --rm mariadb mysql -hmariadb -uroot -p
    Enter your password
    MariaDB [(none)]> CREATE DATABASE nginx;
  4. Edit the config.json file.
  5. Create the nginx proxy manager docker:
    $ docker pull jc21/nginx-proxy-manager:latest
    $ docker create --name=reverse_proxy --restart unless-stopped -v ~/docker_data/proxy/config.json:/app/config/production.json -v ~/docker_data/proxy/data:/data -v ~/docker_data/proxy/letsencrypt:/etc/letsencrypt --network network_name --ip6 2a02:10::11 jc21/nginx-proxy-manager
    $ docker start reverse_proxy
  6. Everything should work until this point.
  7. Access the web ui with Google Chrome using the IPv6 address of the docker.
    http://[2a02:10::11]:81
  8. Try to login with [email protected] and changeme as credentials.
    The web responds with an Internal Error. And if you check the logs of the docker you should see the following message:
    [Express ] › ⚠ warning data should match pattern "^[a-z\-]+:\/\/(?:[\w\-\.]+(:[0-9]+)?/?)?$"

  9. Now restart the docker:
    $ docker stop reverse_proxy
    $ docker start reverse_proxy
    And now the following error apears:
    [emerg] 320#320: invalid port in resolver "fe80::something%2" in /etc/nginx/conf.d/include/resolvers.conf:1 nginx: [emerg] invalid port in resolver "fe80::something%2" in /etc/nginx/conf.d/include/resolvers.conf:1
    Beeing fe80::something the local IPv6 of the docker created before.

Operating System

  • Ubuntu Server

Important comments about IPv6
In order to get access from outside the host you probably need to run the following commands:

(Replace eth0 with your network adapter name (see ifconfig))
(Replace 2a02:10::11 with the address used for the container)
$ sysctl net.ipv6.conf.eth0.accept_ra=2
$ sysctl net.ipv6.conf.eth0.proxy_ndp=1
$ ip -6 neigh add proxy 2a02:10::11 dev eth0

If you are using a local IPv6 block (fe80::/80) you don't need this commands.

I know that IPv6 is not an easy thing to work with but I hope you can fix this bug.

bug

Most helpful comment

Pull the latest or 2.2.2 or 2 images to get this fix.

All 8 comments

Resolved in v2.2.2

I still receive the mentioned Internal Error when trying to access the web ui using IPv6. However the IPv6 configuration is valid and works for other docker containers. Accessing the UI via IPv4 works without any issues.

The ajax request to /api/tokens seems to be the issue. It returns an error code 400.

That's strange - if you can inspect the files inside your running docker container, specifcally /etc/nginx/conf.d/production.conf the configuration should mention listen [::]:81 default; without a preceding comment.

Are you accessing the admin interface directly on port 81 or do you have it behind a Proxy Host?

This is the content of the file you mentioned:

# Admin Interface
server {
    listen 81 default;
    listen [::]:81 default;

    server_name nginxproxymanager;
    root /app/frontend;
    access_log /dev/null;

    location /api {
        return 302 /api/;
    }

    location /api/ {
        add_header            X-Served-By $host;
        proxy_set_header Host $host;
        proxy_set_header      X-Forwarded-Scheme $scheme;
        proxy_set_header      X-Forwarded-Proto  $scheme;
        proxy_set_header      X-Forwarded-For    $remote_addr;
        proxy_pass            http://127.0.0.1:3000/;
    }

    location / {
        index index.html;
        if ($request_uri ~ ^/(.*)\.html$) {
            return 302 /$1;
        }
        try_files $uri $uri.html $uri/ /index.html;
    }
}

I am directly accesing the admin UI without any proxy http://[${IPV6_ADDR}]:81/login

This is the response from the ajax request to /api/tokens:
{"error":{"code":400,"message":"Internal Error"}}

So the docker logs for that container should have some more info about the internal error?

Fix the login, it was a cors issue which wasn't expecting a ipv6 address in the referring url.

Pull the latest or 2.2.2 or 2 images to get this fix.

Thank you very much. The issue is now fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dgeordgy21 picture dgeordgy21  Â·  3Comments

Treppengelaender picture Treppengelaender  Â·  6Comments

HNGamingUK picture HNGamingUK  Â·  3Comments

xanthos84 picture xanthos84  Â·  4Comments

sudvej picture sudvej  Â·  5Comments