Skip to content

Conversation

@theseion
Copy link
Contributor

@theseion theseion commented Feb 6, 2025

proxy_pass will use the resolver whenever the argument contains variables. This isn't usually an issue but it can be if hosts are declared via /etc/hosts, e.g. when useing extra_hosts from docker compose. Then, /etc/hosts would not be considered.

Use the BACKEND variable directly to avoid use of the resolver.

Fixes #330

`proxy_pass` will use the resolver whenever the argument contains
variables. This isn't usually an issue but it can be if hosts are
declared via `/etc/hosts`, e.g. when useing `extra_hosts` from docker
compose. Then, `/etc/hosts` would not be considered.

Use the `BACKEND` variable directly to avoid use of the resolver.

Fixes coreruleset#330
@theseion theseion requested a review from fzipi February 6, 2025 20:16
@fzipi fzipi merged commit 094c358 into coreruleset:main Feb 6, 2025
5 checks passed
@gtaws
Copy link

gtaws commented Feb 6, 2025

Thanks so much! Just to elaborate (because it took me a real long time on Google to figure this out), if proxy_pass sees a variable as its parameter, it will no longer consider /etc/hosts when resolving a host, and only refer the DNS resolver it's been configured to resolve hosts. If proxy_pass sees a literal as its parameter, it will consider /etc/hosts first before referring to the DNS resolver. This is important if you depend on extra_hosts for your container to function correctly.

@theseion theseion deleted the remove-upstream-variable-from-nginx branch February 7, 2025 06:43
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 this pull request may close these issues.

stop using $upstream variable proxy_backend.conf.template for owasp/modsecurity-crs:nginx

3 participants