Open
Description
Link to the code that reproduces this issue
https://github.com/SigNoz/sample-nextjs-app.git
To Reproduce
- get a sample app. git clone https://github.com/SigNoz/sample-nextjs-app.git
- copy official Dockerfile to the sample project (https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile)
- set output to standalone and add basePath, assetPrefix according to the official document
output: 'standalone',
basePath: '/myapp',
assetPrefix: '/myapp',
- build docker image and run.
- modify nginx config to forward proxy
location /myapp/ {
proxy_http_version 1.1;
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;
proxy_pass http://localhost:3000/;
}
}
- run nginx with the new config
- on another machine, open a browser and try to access to https://my-server.com/myapp/
- try to access to http://my-server.com:3000 without proxy
Current vs. Expected behavior
Current:
When I access to proxy link https://my-server.com/myapp/
Nextjs still tries to look for some assets from root /, not /myapp which make only part of style, images looks good.
If I access to my app without proxy: http://my-server.com:3000, everything looks good.
Expected:
The page should load all assets even I'm accessing sub path to my app.
Provide environment information
Operating System:
Platform: Ubuntu
Arch: x64
Version: 24.04.1 LTS
Binaries:
Node: coming from 18-alpine docker image
npm: coming from 18-alpine docker image
Which area(s) are affected? (Select all that apply)
Not Found, Runtime
Which stage(s) are affected? (Select all that apply)
Other (Deployed)
Additional context
No response