Repository nuxt.js

Update router base dynamically

nicolas-bonnel
0
nicolas-bonnel
commented 7 months ago

Hello,

I'm using Nuxt to build an application that can be proxied by another service, the exposition path of the application being dynamic. Is it possible to update router base property once nuxt app is generated ?

I have tried in the nuxtServerInit action of the store the following code, but it doesn't work :

app.router.options.base = '/mypath/'

I have tried updating routing properties of object in the plugins/index.js export function too, but had no success.

Thanks.

0
qm3ster
383
qm3ster
commented 7 months ago

If your server is real node, why don't you just build when you get the path? Does it change frequently and the build would be too long?

0
nicolas-bonnel
0
nicolas-bonnel
commented 7 months ago

Yes it would be too long, the app can be exposed multiple times and be queried on differents URL frequently.

0
brambergvd
0
brambergvd
commented 5 months ago

@nicolas-bonnel any leads on how to solve this?

0
galvez
845
galvez
commented a month ago

@nicolas-bonnel you probably want to do this routing through Nginx or another higher server layer. I'd use / as base, capture the entire URI and do the treatment using a middleware. Closing this as there's been no updates for over 90 days.

0
Informations
QuestionUnresolved
#c2570 - Created 7 months ago