Next.js Discord

Discord Forum

How to change path of chuck links?

Unanswered
Rhinelander posted this in #help-forum
Open in Discord
RhinelanderOP
Hello everyone,
I have an issue that needs assistance. Is there any way I can change path of chuck links in html file for the first load. I used assetPath in next.config.js but it is only works for static pages (not working in getServerSideProps).

5 Replies

Toyger
why you want to do that? theoretically it possible with custom wepback configuration but it can break many other things.
RhinelanderOP
@Toyger I transforming the request to get html from domain2 when accessing domain1. At that time, domain2 will receive the html of domain 1 and download chuck fails (because its path is /_next/static/chucks/... of domain 1).
Ex:
domain1.com/p/123 -> domain2.com/p/123
RhinelanderOP
@Toyger As shown in the image below, at domain1, when the user accesses each corresponding path, the request will be sent to the corresponding subdomain.
@Rhinelander <@536484914221285376> As shown in the image below, at domain1, when the user accesses each corresponding path, the request will be sent to the corresponding subdomain.
Toyger
I still don't understand why do you need that.
But for this you basically use reverse-proxy as nginx, in your case probably you can't install nginx, so you can use something like that https://github.com/http-party/node-http-proxy in front of your 3 sites.