Support different application baseURL than '/'
Nuxt applications allow to be hosted on a different subpath than '/' by setting the app.baseURL configuration parameter. This can also be overridden at runtime by setting the NUXT_APP_BASE_URL environment variable.
Can this setting (both app.baseURL and runtime NUXT_APP_BASE_URL) be respected by nuxt-oidc-auth? Currently, I get always redirected to /auth/login, even when providing a different prefix, e.g. NUXT_APP_BASE_URL=/prefix/. I believe it would be convenient to automatically prefix all relevant configuration parameters with the App baseURL, for example: If i set oidc.providers.[provider].callbackRedirectUrl to "/bye", then actually I should be redirected to "/prefix/bye" if NUXT_APP_BASE_URL=/prefix/ was set.
Hello,
Same wish for me :) i saw it today and i need it too on my side. @patrsc do you have any workarround ?
Same wish for me :) i saw it today and i need it too on my side. @patrsc do you have any workarround ?
No, I didn't try any workarounds yet.
It didn't make it to 1.0.0-beta.1, but it is in the works for one of the betas before 1.0.0!
I just tried to add a prefix in the nuxt config and everything works as expected including the redirections, as the prefix redirection of nuxt always take place before the route rules go into effect. Is there anything specific that is not working for you @patrsc ?
I just updated to 1.0.0-beta.5 and then used an alternate baseURL that works great on a dev build but when doing a build / start to test a production build it fails with a 404 can't find /auth/login
If I prepend the baseURL value to the auth/login page that returned the 404, I get the correct login page but when I try to login it fails because it cannot find the auth/oidc/callback with another 404
These paths use the correct prefix in a dev build and it functions perfectly Is there any trick to get this to work on production builds?
I just updated to 1.0.0-beta.5 and then used an alternate baseURL that works great on a dev build but when doing a build / start to test a production build it fails with a 404 can't find /auth/login
If I prepend the baseURL value to the auth/login page that returned the 404, I get the correct login page but when I try to login it fails because it cannot find the auth/oidc/callback with another 404
These paths use the correct prefix in a dev build and it functions perfectly Is there any trick to get this to work on production builds?
That's very good input! I will include some tests for baseUrl changes, as the e2e tests run on a production build. It should be possible to figure out, why it doesn't work there.
That's very good input! I will include some tests for baseUrl changes, as the e2e tests run on a production build. It should be possible to figure out, why it doesn't work there.
Thanks! I look forward to your findings on this. If it works on a production build for you maybe there is something I am missing. If not hopefully my input helps you get the issue resolved.
That's very good input! I will include some tests for baseUrl changes, as the e2e tests run on a production build. It should be possible to figure out, why it doesn't work there.
I'm wondering if there is any movement on this. We are getting ready to go live on the application and it is going to require a baseUrl prefix on the app.
I was reading the docs here https://github.com/itpropro/nuxt-oidc-auth/blob/bc044d93f213d9e5e732c9c114181acc9e5fb94a/docs/content/3.server-utils/1.middleware.md?plain=1#L9
"This module can automatically add a global middleware to your Nuxt server. You can enable it by setting globalMiddlewareEnabled under the middleware section of the config.
The middleware automatically redirects all requests to /auth/login if the user is not logged in. You can disable this behavior by setting redirect to false in the middleware configuration."
I tried to use the redirect set to false but it doesn't seem to do anything as far as stopping the redirects from happening before the and putting up a 404 page (not our 404 page) and although the url path shows up correctly on the location bar the view is still on a 404 page. If I put the cursor in the location bar and hit enter it shows the correct page view.
I tried to set globalMiddlewareEnabled: false but that also has ne effect on the redirects that happen without the app baseUrl path being rendered either.
Really at a loss as to how to make this work for us with the baseURL set in production builds.