nuxt-community / axios-module

Secure and easy axios integration for Nuxt 2
https://axios.nuxtjs.org
MIT License
1.19k stars 245 forks source link

Question: Set baseUrl based on req.headers.host #489

Closed badoubadou closed 3 years ago

badoubadou commented 3 years ago

Hi, I have a nuxt app, I push to heroku, and send mysubdom1.mydom.com to the app. The BaseUrl is defined in my nuxt.config.js as mysubdom1-admin.mydom.com. It's working fine, but I would like to send mysubdom2.mydom.com to the same app. And I would like to have the baseUrl, for now defined in my nuxt.config.js, to be mysubdom2-admin.mydom.com. I tried to use nuxtServerInit, and nuxtClientInit with req.headers.host, but it didn't work. I think I need to use a server middleware, but I can't find a proper example on how to do what I want. If someone can point to a very basic exemple on how to do that, it would be of great help. Thanks !