diff --git a/docs/README.md b/docs/README.md index 7bc6f12..32df921 100644 --- a/docs/README.md +++ b/docs/README.md @@ -844,6 +844,8 @@ docker run --detach \ --volume /path/to/custom-vhost-config.conf:/etc/nginx/vhost.d/app.example.com:ro \ nginxproxy/nginx-proxy ``` +#### Per-VIRTUAL_HOST http location +To add settings on a per-`VIRTUAL_HOST` basis but for the http part, add your configuration file under `/etc/nginx/vhost.d` just like the previous section except with the suffix `_http`. This allow you to add configuration before the https redirection like the acme challenge. This is mostly usefull for all others 'not supporting https redirect' `.well-known` URIs. diff --git a/nginx.tmpl b/nginx.tmpl index 14e30ca..d106a14 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -891,6 +891,9 @@ server { {{- if $globals.config.enable_ipv6 }} listen [::]:{{ $globals.config.external_http_port }} {{ $default_server }}; {{- end }} + {{- if (exists (printf "/etc/nginx/vhost.d/%s_http" $host)) }} + include {{ printf "/etc/nginx/vhost.d/%s_http" $host }}; + {{- end }} {{- if (or $vhost.acme_http_challenge_legacy $vhost.acme_http_challenge_enabled) }} # Do not HTTPS redirect Let's Encrypt ACME challenge