platformOS Community

[Solved] URL using two dots

Arie Apr 15 2021 at 02:36

I want to capture params using {{context.headers.REQUEST_URI}}


But when this URL has two dots

/_next/static/chunks/hello.there.js [its not working]. Its become 404

How to capture this params ?

I put in config file "/assets"


Pawel Apr 15 2021 at 08:04

Getting params might be easier to get from context.params ( )

For example url:

Will return:


Having said that, i would say getting urls to webpack/next chunks is a bad idea. They should be loaded programmatically/dynamically from your main entrypoint.

Pawel Apr 22 2021 at 14:21

We use queryparams for cache busting of main files (app.js, app.css) so it looks like this:


(Read at )

And all the chunks (that are generated by webpack, nextJS probably too) are loaded by webpack (next) internals, because it has manifest of all the assets generated during build time.

To have dynamic CDN (because we use multiple instances, stagings, productions, etc.) URL we use a webpack plugin - read at:

Generally it is worth the time to discover how particular framework can do relative paths to assets/chunks, because it will create a lot of problems down the road if its not simple and just works always.

Arie Apr 16 2021 at 01:26

Thanks Pawel.

I just thinking how to make it more simple after "npm run build" from NextJS without more changes of the result files.
Because every build the files name are always changed

Please sign in or fill up your profile to answer a question