fix(proxy): route /export/* to the backend so PDF export works#235
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Clicking Print in production failed with:
Root cause
The PDF export feature (already on
main) is correct end to end:POST /export/table.pdf(backend/routers/export.py, mounted inmain.py).…/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 thelocation /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.confto also cover/export/*:client_max_body_size 20Mis already set globally, which covers the export payload (table rows posted as text).Validation
/graphql,/callback,/export/table.pdf→ backend;/,/tasks,/export/(no file),/exporting,/graphqlx→ frontend.nginx -tagainst the rendered template — worth a quicknginx -tin 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
proxyimage, the same/export/*→ backend rule must be added there too.Generated by Claude Code