Deploying to custom server #1556
Replies: 5 comments 3 replies
-
Do you mean you get a redirect where the host is changed to I have a feeling this could be an issue with a reverse proxy. Is there an internal proxy that calls the Next.js server with e.g. Can you try if you get the same error with this middleware instead of the one from export default function middleware(request: NextRequest) {
if (request.nextUrl.pathname === '/') {
const url = new URL('/de', request.url);
return NextResponse.redirect(url.toString());
}
} … and then call
Absolutely, yes—if you run |
Beta Was this translation helpful? Give feedback.
-
Thanks for the fast reply! If i go to our homepage https://frontend.foundation.ef2.builders/ It redirects to localhost:3000/nl. Thats because nl is our default language. But instead of going to our root domain, it goes to localhost. The server is setup so it has a loopback to another ip address environment=HOST="127.110.72.233",PORT="3000" Added the above code, the /nl does now work (changed /de to /nl). So it maybe has something to do with the middleware? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the fast response, gonna dig into it :) |
Beta Was this translation helpful? Give feedback.
-
Well, delved deeper and deeper. I removed the next-intl all together and added a single redirect in the middleware from the docs and i get the same result. Asked the hosting provider if they can come up with a solution. Because normal rewrites are also a big part of our projects. Thanks for the help! |
Beta Was this translation helpful? Give feedback.
-
Too bad I still dont have a solution. We tried everything but redirects are not working correctly because of the headers. Currently rewriting them in the middleware doesnt work, because i get a 431 with an infinite loop. So currently my only option is to use Vercel, which i really really don't want to. |
Beta Was this translation helpful? Give feedback.
-
Hi,
Im want to bring all our Next.js websites over from vercel to our own hosting solution. This hosting solution does not operate on localhost (or 127.0.0.1) but on another IP address. I can correctly start the Next.js server using the -H parameter.
But everytime i want to visit a locale on the site (i.e. example.com/nl) it gets a loopback to localhost (https://localhost:3000/nl)
The logs show the following:
`✓ Starting...
▲ Next.js 14.2.16
✓ Starting...
✓ Ready in 221ms`
Failed to proxy https://localhost:3000/nl AggregateError at internalConnectMultiple (node:net:1114:18) at afterConnectMultiple (node:net:1667:5) at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) { code: 'ECONNREFUSED', [errors]: [ Error: connect ECONNREFUSED ::1:3000 at createConnectionError (node:net:1634:14) at afterConnectMultiple (node:net:1664:40) at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '::1', port: 3000 },
When i disable next-intl it works.
Does next-intl work without vercel?
Beta Was this translation helpful? Give feedback.
All reactions