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

Automatically generated nginx resolver setting is invalid when /etc/resolv.conf contains IPv6 addresses #1437

Closed
ldruschk opened this issue Nov 12, 2022 · 5 comments · Fixed by #1439

Comments

@ldruschk
Copy link

Hi,

the code for generating the nginx resolver setting when the setting is not explicitly specified can be found here:

export NGINX_RESOLVER=$(grep nameserver /etc/resolv.conf | cut -d" " -f2 | tr "\n" " " | sed -e "s/[[:space:]]*$//")

When the /etc/resolv.conf contains IPv6 addresses, the resulting config snippet looks as follows:

resolver 127.0.0.11 2a03:4000:0:1::e1e6

This results in the following error, leading to nginx not being able to start:

nginx: [emerg] invalid port in resolver "2a03:4000:0:1::e1e6" in /config/nginx/nginx.conf:30

According to the documentation IPv6 resolvers must be specified by surrounding the addresses with brackets: https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver

When manually changing the setting to the following, nginx starts up normally

resolver 127.0.0.11 [2a03:4000:0:1::e1e6]
@saghul
Copy link
Member

saghul commented Nov 13, 2022

What environment is that?

saghul added a commit that referenced this issue Nov 15, 2022
saghul added a commit that referenced this issue Nov 15, 2022
Bishwarupjee added a commit to Bishwarupjee/docker-jitsi-meet that referenced this issue Jan 6, 2023
@cdauth
Copy link

cdauth commented Jun 25, 2023

Do I see it right that this has not made it into the stable release yet?

@saghul
Copy link
Member

saghul commented Jun 25, 2023

The commit has been in 9 stable release, since 8044.

@cdauth
Copy link

cdauth commented Jun 25, 2023

Ah, I got confused since I didn't see it in the release notes and the commit in the pull request didn't show any branches/commits (it seems that the pull request doesn't contain the same commit as the master branch).

Anyways, I am running into this error message with the current stable image. The /etc/resolv.conf file inside the container looks like this:

nameserver 127.0.0.11
nameserver fd63:2af7:9f8b:ef5a:1::1
nameserver fe80::216:3eff:fef4:3236%11
options ndots:0

Which results in the following nginx config:

resolver 127.0.0.11 [fd63:2af7:9f8b:ef5a:1::1] [fe80::216:3eff:fef4:3236%11];

This results in the following error message:

nginx: [emerg] invalid IPv6 address in resolver "[fe80::216:3eff:fef4:3236%11]" in /config/nginx/nginx.conf:30

I have found an nginx issue that might explain this: https://trac.nginx.org/nginx/ticket/2509

It seems like the /etc/resolv.conf file inside the container is the same as on my system, so as a workaround I guess I have to investigate how that address ends up there in the first place and get rid of it.

@saghul
Copy link
Member

saghul commented Jun 26, 2023

Looks like it doesn't like the scope ID.

I'd take a PR which filters those addresses while Nginx fixes it.

If you want to take a crack at it, just ignore the addresses with a % in them.

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

Successfully merging a pull request may close this issue.

3 participants