nginx-proxy / nginx-proxy/nginx-proxy
The template can (and sometimes does) generate an empty upstream section
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 19.9k
- Forks
- 3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 1
Description
The default nginx.tmpl occasionally generates an empty upstream section for a vhost, which causes a validation error and inability to reload (or start) nginx.
It happened several times to me, I can't exactly recall the conditions under which this can happen, but next time I hit this I'll update the bug report.
Most probably something to do with the condition on this line, which doesn't have an "else" clause:
{{ if (and (ne $containerNetwork.Name "ingress") (or (eq $knownNetwork.Name $containerNetwork.Name) (eq $knownNetwork.Name "host"))) }}
Is there some easy way of detecting if the generated block is empty, and omitting the configuration for that particular vhost altogether? Also perhaps exposing some metrics to signify the condition to a monitoring system...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the default nginx.tmpl and inspect the condition around the upstream generation, then reproduce the empty upstream in a generated vhost configuration. Done means the template no longer produces an empty upstream section and the resulting configuration passes nginx validation and can reload successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, nginx
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100