nginx-proxy: asterisk VIRTUAL_HOST doesn't work with latest nginx-proxy
I’m using *.domain.com
as VIRTUAL_HOST
but it fails on recent version of nginx-proxy, it worked before just fine, so I had to roll back to previous version.
Version that works fine is from 5 month ago, idk exact version:
Any ideas what happened in new version?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 25 (8 by maintainers)
@sandrodz that was a tricky one, but I got it figured out.
tl;dr
in your docker-compose file, replace
with
Analysis
In the yaml syntax, the Block scalar indicator
|
preserves new line characters. nginx-proxy breaks when there are new line characters in the value of aVIRTUAL_HOST
environment variable. (and by the way jrcs/letsencrypt-nginx-proxy-companion has this same restriction for theLETSENCRYPT_HOST
environment variable).The yaml Folded scalar indicator
>
removes the new lines characters.@jwilder in the end, #671 or #679 are not involved in the current state of this issue. One way to be more forgiving for users would be to have nginx-proxy trim the
$host
values fromVIRTUAL_HOST
as @md5 suggested in #271. In my tests, just adding{{ $host := trim $host }}
allows for any kind of white character (new line include) to be part of theVIRTUAL_HOST
environment variable without affecting the validity of the nginx configuration file.