NuxtN
Nuxtβ€’3y agoβ€’
13 replies
jd_solanki

How to get full req URL in server plugin & update appConfig that gets carried/reflected to client

Hi πŸ‘‹

I'm building nuxt template and encoutering strange case where I want to deploy single nuxt app and want to server it from 6 different URL for different demo purposes.

Question:
How can I get full requested URL in server plugin like domain.com/demo-1/ (I need subpath ("demo-1") my nuxt is serving to). Based on this requested path I want to alter the appConfig from server plugin and want to reflect that config in client app. e.g. demo-1 will have light theme & demo-2 will have dark theme.

I tried getting full url but nuxtApp.ssrContext?.event.node.req.url only gives app's route path not requested URL. 🀷 (something like this: https://nuxt.com/docs/getting-started/testing#urlpath)
Nuxt
How to test your Nuxt application.
Testing Β· Get Started with Nuxt
Was this page helpful?