nginx-proxy / nginx-proxy/nginx-proxy

The template can (and sometimes does) generate an empty upstream section

Open
#1,091 2 comments 6 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.