Skip to content

Multiple nextJs apps on same TLD - change _next path #37615

Discussion options

You must be logged in to vote

I think I just solved it. This article pointed me to the right direction: https://arihantverma.com/posts/2021/07/18/workaround-nextjs-data-urls-same-domain-multiple-apps/

So what I am doing now is using custom build IDs and prefixing them with dashboard- and website-. Then I proxy all requests via nginx to the related apps:

       location ~ ^/(_next/data/dashboard-) {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        }
       location ~ ^/(_next/data/website-) {
        proxy_pass htt…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by leerob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant