Repository nuxt.js

Use nuxt.js renderer instance for multiple backends

commented 10 days ago

I want to use a single instance of nuxtjs renderer to serve multiple webapps.

Basically I want to achieve this setup, where the routing is based on the host header:                   +------+api1
                +--+nuxt js renderer+                   +------+api2

I've tried to configure Nuxt JS Axios Proxy Module like this, but both domains are proxied to the first upstream

  proxy: {
    '': {
      target: 'http://localhost:8888'
    '': {
      target: 'http://localhost:8889'

Solutions I struggled so far:

  • Use nuxt proxy. See above.
  • Use Nginx as proxy. I tried to redirect all requests to the main domain, i.e. and nginx takes care about proxying requests to api, but I have no idea how to tell nuxt to proxy request to the currentHost

Can you suggest any solution for use cases like this?
Thank you very much.

#c7530 - Created 10 days ago