Skip to content

Commit 69433e2

Browse files
committed
Forward to gunicorn with HTTP/1.1
nginx forwarded with HTTP/1.0, so each request, such as the health check, appeared once as HTTP/1.1 in the log of nginx and once as HTTP/1.0 in the log of gunicorn, which looked like an upgrade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> AI Prompts: claude-opus-5-5: rad the docs is set up claude-opus-5-5: Th health check always does an HTTP upgrade. Can that be 1.1 from the start? 12:20:34info127.0.0.1 - - [05/Nov/2026:12:20:34 +0000] "GET /health/ HTTP/1.0" 200 67 "-" "Python-urllib/3.13" 12:20:34info127.0.0.1 - - [05/Nov/2026:12:20:34 +0000] "GET /health/ HTTP/1.1" 200 67 "-" "Python-urllib/3.13" claude-opus-5-5: <pasted_content id="9066"> Th health check always does an HTTP upgrade. Can that be 1.1 from the start? 12:20:34info127.0.0.1 - - [05/Nov/2026:12:20:34 +0000] "GET /health/ HTTP/1.0" 200 67 "-" "Python-urllib/3.13" 12:20:34info127.0.0.1 - - [05/Nov/2026:12:20:34 +0000] "GET /health/ HTTP/1.1" 200 67 "-" "Python-urllib/3.13" </pasted_content id="9066"> claude-opus-5-5: commit and push
1 parent 7dc6856 commit 69433e2

4 files changed

Lines changed: 20 additions & 5 deletions

File tree

‎docker/nginx.conf‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ http {
3636

3737
location / {
3838
proxy_pass http://127.0.0.1:8000;
39+
# HTTP/1.1 to gunicorn as from the browser; nginx would send HTTP/1.0
40+
proxy_http_version 1.1;
41+
proxy_set_header Connection "";
3942
proxy_set_header Host $http_host;
4043
proxy_set_header X-Real-IP $remote_addr;
4144
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

‎news/+nginx-http-1-1.misc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nginx forwards requests to gunicorn with HTTP/1.1 instead of HTTP/1.0.

‎tests/pages/test_health.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,12 @@ def test_the_health_check_imports_only_the_standard_library():
147147
outside = {m for m in modules if m not in sys.stdlib_module_names and not m.startswith("_")}
148148
assert outside == set()
149149
assert "urllib" in modules
150+
151+
152+
def test_nginx_forwards_with_http_1_1():
153+
"""nginx forwards to gunicorn with HTTP/1.1, as requests come in, not with HTTP/1.0."""
154+
from pathlib import Path
155+
156+
config = (Path(__file__).parents[2] / "docker" / "nginx.conf").read_text()
157+
assert "proxy_http_version 1.1;" in config
158+
assert 'proxy_set_header Connection "";' in config

‎todo.txt‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ response times, who contributes how and when, verifiable numbers and badges.
150150
- [x] Internationalization: every text of the site translatable (Django i18n: templates, Python, JavaScript), the language of the browser or chosen in the footer, a first translation (German, "du")
151151
- [x] Internationalization, the rest: the details of the errors that pages show (forms, queries, dates, classes, adding repositories, visitor limits), the descriptions of the query variables, the texts in charts (axes, titles, legends, weekdays); the allauth pages use the translations of allauth; the badges stay English; the names of the columns of the exports stay English (scripts read them); the messages of fetches that run in the background stay English (no language there)
152152
- [ ] German texts: checked by a person who speaks German (written by Claude); "Du" with a capital letter was decided
153+
- [ ] Spanish texts: checked by a person who speaks Spanish (written by Claude, with the informal tú)
153154
- [x] Bootstrap 5, mobile first, light and dark
154155
- [x] Green palette as CSS variables in `static/style.css` (#149414 #0e6b0e #649568 #9ccc9c #2b5329); white text only on #0e6b0e / #2b5329 (contrast >= 4.5), dark text on #9ccc9c
155156
- [x] Charts (matplotlib) in the colours of the website: green palette, series told apart by lightness with gaps between stacked bars, heat map from light to deep green (`community_insights/charts.py`)
@@ -224,13 +225,13 @@ Project constraints:
224225
- [x] Tags `v1.2.3` publish `stable`, `1.2.3`, `1.2`; main publishes `latest`
225226
- [x] CI workflow (`.github/workflows/tests.yml`: news fragment, ruff, pytest, docs, docker build)
226227
- [x] Publish the Docker image to ghcr.io from `.github/workflows/tests.yml`, only after all tests passed: `latest` from main, `stable` and versions from tags, with build information
227-
- [ ] No `stable` image exists until the first tag: the compose file uses `:stable`
228+
- [x] No `stable` image exists until the first tag: the compose file uses `:stable`: v0.1.0 published it
228229
- [x] pre-commit: ruff, yaml/toml checks, whitespace
229230
- [x] Documentation with Sphinx in `docs/` (Diataxis like calendaring-sync): setup, OAuth app, Docker, Compose, latest version, development setup, environment variables, classes, badges, bug reports
230231
- [x] Docs: email sign-up, tokens, browser and node tests, version information
231232
- [x] Changelog with towncrier (`news/`, fragments without `.rst`, `docs/changelog.rst`)
232233
- [x] Small README that only links to the docs
233-
- [ ] Read the Docs project community-insights and the first release tag
234+
- [x] Read the Docs project community-insights (set up by the person; the docs and the changelog of 0.1.0 are online) and the first release tag v0.1.0
234235
- [x] Vale prose checks, REUSE licensing (`REUSE.toml`, `LICENSES/`), SECURITY.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md like calendaring-sync, as jobs of tests.yml
235236
- [x] Coverage report (pytest-cov, Codecov upload in CI)
236237

@@ -285,7 +286,7 @@ Approved: all Django packages may be used where they replace code or enable requ
285286
### Licenses and versions
286287
- [x] Implemented: `pip-licenses` reads the Python packages of the About page; their licenses link to the texts at /about/licenses/<name>/
287288
- [x] Implemented: `hatch-vcs`: the version from the git tag (pyproject.toml, docker/set-version.sh, the push job fetches the history)
288-
- [ ] Tag the first release (such as v0.2.0, the version pyproject.toml had): until then the version is 0.0.1.devN
289+
- [x] Tag the first release (such as v0.2.0, the version pyproject.toml had): until then the version is 0.0.1.devN: v0.1.0
289290
- [x] reuse licenses must also be included in the license page (About: Code from other projects, from REUSE.toml)
290291

291292
### Tests
@@ -407,7 +408,7 @@ Approved: all Django packages may be used where they replace code or enable requ
407408
- [x] Checked the deployment step of the push job: curl is on ubuntu-latest; suggested `--fail-with-body` and a newline at the end of the file.
408409
- [x] CI failed (040b2ce): the new job "deploy" was missing from the jobs the push does not wait for (tests/quality/test_ci.py); a test checks that deploy needs push and runs only for pushes
409410
- [x] CI failed: the browser tests at 375x812 timed out on the first page on a slow runner (reproduced on one busy CPU); pages get 60 s to load, actions and expect 30 s
410-
- [ ] Log gh in (`gh auth login`), so that the logs of the CI can be read with `gh run view --log-failed`
411+
- [x] Log gh in (`gh auth login`), so that the logs of the CI can be read with `gh run view --log-failed`: gh works, the CI logs were read with it
411412
- [x] The deployment had no token ("Authentication required"): the job deploy names the environment insight.pycal.org, whose secret SENCHO_TOKEN it passes to curl through env
412413
- [x] Mail over port 465 (smtp.zoho.com) failed with SMTPServerDisconnected: EMAIL_USE_SSL is read; port 465 chooses it, other ports EMAIL_USE_TLS; both true stops the start (EmailEncryptionConflict, community.E002); in .env.example and the docs
413414
- [x] Images kept until the data changes, with ETags: a stamp of the data from the notes of django-cachalot per table, the hour and the version (data_stamp.py); charts, chart data and badges are kept and answer 304 (views/stamped.py); the contributors are kept (Scope.contributors)
@@ -486,8 +487,9 @@ Approved: all Django packages may be used where they replace code or enable requ
486487
- [x] Commit, push, fix the CI until it is green so that it deploys (asked by the person): 377f843 and three fixes of browser tests that raced in CI; run 41695390067 green, deployed (Version 0.0.1.dev27)
487488
- [x] Release 0.1.0 (asked by the person): changelog built by towncrier, tag v0.1.0
488489
- [x] The deploy of main failed with 409 "already updating" while the deploy of the tag v0.1.0 ran: re-run, and the deploy job runs one at a time (concurrency group)
490+
- [x] The health check seemed to upgrade from HTTP/1.0 to 1.1: the two lines are one request, logged by nginx (HTTP/1.1 from urllib) and by gunicorn (HTTP/1.0 from nginx); nginx now forwards with HTTP/1.1 (proxy_http_version)
489491
- [ ] Install Trivy on the Sencho node, so its post-deploy scan runs (on the server: not possible from here)
490492
- [x] The tests failed with "disk I/O error": the test database data/test-db.sqlite3 of the interrupted run is broken (4 KB with an old -shm); the tests pass with DATA_DIR in the scratchpad. Ask before deleting data/test-db.sqlite3*
491-
- [ ] Decide: "only those that do not reply at all should have a column": now the columns are filled for yellow and red rows; green rows show "-"
493+
- [x] Decide: "only those that do not reply at all should have a column": now the columns are filled for yellow and red rows; green rows show "-"; settled by the later prompts on the columns of the table
492494
- [x] Lazy imports of matplotlib, lifelines, statsmodels, scipy, pandas and pyarrow (decided): a web process starts with 85 MB instead of 290 MB and loads them with the first statistics or chart; a test checks that none is loaded at the start; the browser tests found a deadlock of Python's import when threads load matplotlib at the same time: all lazy imports of the large libraries happen behind one lock (heavy.LOCK), tested in a fresh process
493495
- [x] Measure the memory of the fetch worker during a large fetch: 104-112 MB at most while reading all 1971 pull requests and issues of collective/icalendar (a copy of the local database in the scratchpad). The fetch failed twice on GitHub 504 / not JSON (heavier queries with commits): the client now tries server errors and unreadable answers again, 1, 2 and 4 s later; then the fetch finished in one run

0 commit comments

Comments
 (0)