Self-hosted NextJS app behind nginx proxy is doing full page refresh instead of soft-navigation
Unanswered
Skipjack tuna posted this in #help-forum
Skipjack tunaOP
Whenever a link is clicked and navigation is fired, the browser does a full refresh instead of soft-navigation. However, this only happens when using nginx, if the app is accesed locally or through Vercel, the soft navigation of the SPA works.
I can confirm it still fails with latest canary and also since (at least) v13.1. I have been downgrading my NextJS app till that version and the problem still persists.
This is my nginx config:
location / {
proxy_pass https://sample-project-javiermartinz.vercel.app/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host sample-project-javiermartinz.vercel.app;
proxy_ssl_server_name on;
proxy_cache_bypass $http_upgrade;
}
You can check both behaviours with this sample project:
https://sample-project.javimartinez.es/ full page refresh
https://sample-project-javiermartinz.vercel.app/ soft navigation
I can confirm it still fails with latest canary and also since (at least) v13.1. I have been downgrading my NextJS app till that version and the problem still persists.
This is my nginx config:
location / {
proxy_pass https://sample-project-javiermartinz.vercel.app/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host sample-project-javiermartinz.vercel.app;
proxy_ssl_server_name on;
proxy_cache_bypass $http_upgrade;
}
You can check both behaviours with this sample project:
https://sample-project.javimartinez.es/ full page refresh
https://sample-project-javiermartinz.vercel.app/ soft navigation