Events 3.6.1: branding uploads work behind a proxy with extension rules
The logo/favicon upload succeeded, but the check that the site can show it got a 404: on events-demo every /api/... path ending in a file extension (.png, .ico, .pdf, .json) went to Next.js instead of the backend. - next.config.ts: /api/* and /uploads/* that reach the site are passed to the backend (beforeFiles rewrites) via the new BACKEND_INTERNAL_URL (http://127.0.0.1:<apiPort>, from env.template.json on deploy). The e2e E2E_API_PROXY uses the same rewrites. - nginx written by both installers and shown in DEPLOYMENT.md: /api/ and /uploads/ use location ^~ so no regex location can take them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-7
@@ -517,15 +517,18 @@ server {
|
||||
server_name $domain;
|
||||
client_max_body_size 25m;
|
||||
|
||||
# For the backend locations below ("location /" sets its own).
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
|
||||
# The API, uploaded files, health and API docs go to the backend; everything else to the site.
|
||||
# (From Events 2.2.0 everything is under /api; the other paths are for older releases.)
|
||||
location ~ ^/(api|uploads|health|docs)(/|\$) {
|
||||
proxy_pass http://127.0.0.1:$api;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
}
|
||||
# ^~ so a regex location added later (e.g. caching *.png) can't send /api/…/logo.png to the site.
|
||||
location ^~ /api/ { proxy_pass http://127.0.0.1:$api; }
|
||||
location ^~ /uploads/ { proxy_pass http://127.0.0.1:$api; }
|
||||
location ~ ^/(api|uploads|health|docs)(/|\$) { proxy_pass http://127.0.0.1:$api; }
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:$web;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
Reference in New Issue
Block a user