Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default root url #2289

Closed
sepiropht opened this issue Jun 16, 2017 · 4 comments
Closed

Change default root url #2289

sepiropht opened this issue Jun 16, 2017 · 4 comments

Comments

@sepiropht
Copy link
Contributor

sepiropht commented Jun 16, 2017

I have an next/js app behind nginx with custom server node/express .
I launch it to port 3000. Nginx redirect the request myserver.com/mynextapp/ to port 3000 , but this is not working.
I can see the page server rendered, but the js doesn't working . In browser tool network i got 404 response for app.js and page/, because the request is myserver.com/_next/228ef92e59d376f055fc2c6d01c93b82/app.js instead of myserver.com/mynextapp/_next/228ef92e59d376f055fc2c6d01c93b82/app.js
It worked well when i simply opened the port 3000 in myserver.com but i try to avoid that.
Any idea ?
Thanks

@timneutkens
Copy link
Member

This is a duplicate of #257. Please see that issue for some community solutions 👍

@qwang06
Copy link

qwang06 commented Jun 19, 2017

I ran into this issue as well and none of the solutions in #257 seem to resolve this.

I ended up modifying the server/index.js file and updating the routes in the method defineRoutes:
Object.keys(routes).map(route => { routes[this.renderOpts.assetPrefix + route] = routes[route]; });

I know this isn't the best solution right now but it's the only thing that works. Hopefully support for something like this is available in the future so I don't have to straight up modify core code.

@sepiropht
Copy link
Contributor Author

ok thanks for this, i will check that !

@radeno
Copy link
Contributor

radeno commented Jul 11, 2017

@qwang06 how did you modify predefined next server routes?
It is something i need too. By i don't want to modify original file.

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants