Static Assets URL Rewrite

We’re currently attempting to do the following:
https://tyk.mydomain.com/docshttps://docs.mydomain.com

The docs are built with next.js and resolve static assets to this path: /_next/static/chunks/framework-2c79e2a64abdb08b.js

When loading /docs, all the static assets are 404s coming from /_next/static/chunks/framework-2c79e2a64abdb08b.js (excluding the /docs)

I have tried the “Strip Listen Path” on/off to see if this helps resolve the relative URLs, but it does not help.

Is a URL rewrite necessary to include /docs as part of the relative static path?

you would need to forward traffic sent to both URLs to get routed to your upstream:

https://tyk.mydomain.com/docs 
https://tyk.mydomain.com/

or

https://tyk.mydomain.com/docs 
https://tyk.mydomain.com/_next

This would mean setting up multiple (API) proxy definitions or using a custom domain name.

Is the docs URL being served on the same hostname as the rest of your APIs?

Is the docs URL being served on the same hostname as the rest of your APIs?

Yes, we are just trying to keep the domain universal in that respect.

Is there a URL rewrite pattern that would allow us to get this pattern?:
https://tyk.mydomain.com/docs/_next/static/chunks/framework-2c79e2a64abdb08b.js

It would be less than ideal to reserve /_next for just the docs.

I don’t think this is accurate:

https://tyk.mydomain.com/docs/_next/static/chunks/framework-2c79e2a64abdb08b.js

It seems like you need:

https://tyk.mydomain.com/_next/static/chunks/framework-2c79e2a64abdb08b.js

Anyways, have you looked into NextJs BasePath feature?

It’s for this use case