nginx: PORT env override is documented but does not exist; add it and server_tokens off #26
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
1.
PORTis not overridableREPO_POLICIES.md: "Dockerized web services listen on port 8080 by default, overridable withPORT."nginx.conf:2is a static literal:There is no
envsubst, notemplates/directory, no entrypoint script.Dockerfile:16copies the file verbatim to/etc/nginx/conf.d/netwatch.conf. The override simply does not exist.README.md:138claims otherwise — "Listens on port 8080 by default (override withPORTenv var)" — so the documentation is wrong.TODO.md:31confirms the hardcoding was deliberate at the time: "port hardcoded to 8080". (The README correction is tracked in #24; this issue is the code fix.)Note the backend already does this correctly:
backend/internal/config/config.godefaultsPORTto 8080 via viper and it is genuinely overridable. Only the nginx frontend image is non-compliant.2.
server_tokens off;is absentnginx advertises its exact version in every response header and on every error page.
REPO_POLICIES.md: "if a standard security hardening measure exists for HTTP services and is not listed here, it is still expected."3. Minor, same file
location = /50x.htmlerror page mapping.Definition of done
PORTenvironment variable, defaulting to8080when unset. The official nginx image supports/etc/nginx/templates/*.conf.templatewithenvsubst— prefer that over a hand-rolled entrypoint script.PORTset and confirm it listens on 8080; run it withPORT=9090and confirm it listens on 9090. Report both results in the PR.envsubstover an nginx config will eat$uri,$host, and every other nginx runtime variable — the template must restrict substitution to${PORT}explicitly. This is the most likely way to get this wrong; confirm in the PR thattry_files $uri $uri/ /index.htmlsurvives intact in the rendered config.server_tokens off;is set.EXPOSEin theDockerfilestill documents the default of 8080.docker build .succeeds;make checkpasses.TODO.mdupdated in the same commit.(closes #N).Implementation requirements
nginx.confto add security headers. Whichever lands second must rebase onto the first rather than reverting it. If both are in flight, say so in the PR description.set_real_ip_fromreverse-proxy configuration or the stdout access logging — both are already correct.README.md:138here; that belongs to #24. Fixing the code is this issue's job.