Next.js as an app at a URL endpoint [ex: domain.com/projects/myproject/*] app-router just... doesn't
Wondering if anyone else has seen/fixed this problem. I have a Lightsail instance on AWS that hosts my portfolio (probably moving this to Vercel to avoid the headache, tbh).
I thought I could save some money by deploying projects for my portfolio by deploying it on subdomains. Setup Apache ProxyPass and SSL, and everything works if I go to the landing page of subdomain.mydomain.com. The second I try to route anywhere else it goes straight to the domain without a subdomain (i.e.: subdomain.mydomain.com/login ---> mydomain.com/login).
So I tried instead to have it as an endpoint on my domain, but this also drops the "/projects/myproject" part of the URL path (mydomain.com/projects/myproject/anything-else ---> mydomain.com/anything-else).
I've tried adding basePath and assetPrefix to next.config.js, but if I do that the landing page stops working entirely. Also, anything trying to request with /_next seems to be giving 404. I also tried rewrite() and async rewrite() without success.
Sort of at my wits end with google, bing chat, and a lot of documentation reading (using v14, but also read older docs). I just can't seem to make this work, and I'm not sure if it's an AWS issue, Apache issue, Next.js issue, or just a "you're a noob and missed something obvious, it happens" issue.
Any other ideas (besides get off of AWS, which I'm already strongly considering)? I really want to know why I can't run my app at an endpoint like the docs say I should be able to do.
0 Replies