Skip to content

fix(proxy): route /export/* to the backend so PDF export works#235

Merged
felixevers merged 1 commit into
mainfrom
claude/fix-print-export-proxy-route
Jun 3, 2026
Merged

fix(proxy): route /export/* to the backend so PDF export works#235
felixevers merged 1 commit into
mainfrom
claude/fix-print-export-proxy-route

Conversation

@felixevers
Copy link
Copy Markdown
Member

Problem

Clicking Print in production failed with:

POST https://tasks.helpwave.de/export/table.pdf 404 (Not Found)
Error: PDF export failed with status 404

Root cause

The PDF export feature (already on main) is correct end to end:

  • Backend serves POST /export/table.pdf (backend/routers/export.py, mounted in main.py).
  • The frontend derives the URL from the GraphQL endpoint (…/graphql…/export/table.pdf), which is the right origin.

But the nginx reverse proxy only forwarded ^/(graphql|callback)$ to the backend. Every other path — including /export/table.pdf — fell through to the location / block and was sent to the frontend, which has no such route → 404.

Dev never hit this because the frontend talks to the backend directly (no proxy), which is why it worked locally but not in production.

Fix

Extend the backend location match in proxy/nginx.conf to also cover /export/*:

location ~ ^/(graphql|callback|export/.+)$ {
    proxy_pass http://backend_upstream;
    ...
}

client_max_body_size 20M is already set globally, which covers the export payload (table rows posted as text).

Validation

  • Verified the regex routes exactly the intended paths and nothing extra: /graphql, /callback, /export/table.pdf → backend; /, /tasks, /export/ (no file), /exporting, /graphqlx → frontend.
  • nginx isn't installed in this environment, so I couldn't run nginx -t against the rendered template — worth a quick nginx -t in the proxy image before/after deploy.

Note

If production fronts the app with a separate ingress (e.g. a Kubernetes Ingress in an infra repo) rather than this proxy image, the same /export/* → backend rule must be added there too.


Generated by Claude Code

The table PDF export posts to /export/table.pdf, but the nginx reverse proxy
only forwarded /graphql and /callback to the backend; every other path fell
through to the frontend, so the request returned 404 in production.

Extend the backend location match to also cover /export/* so the PDF export
endpoint is reachable through the proxy. Dev is unaffected (the frontend talks
to the backend directly).
@felixevers felixevers merged commit 062f9cb into main Jun 3, 2026
15 checks passed
@felixevers felixevers deleted the claude/fix-print-export-proxy-route branch June 3, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants