Skip to content

Server components (nuxt island) urls are relative and can't be resolved from other domains or subdomains #32751

@maximelebreton

Description

@maximelebreton

Environment

Hello everybody, and first of all, thanks to all the team for your incredible job!

Here is the context:
I have a Nuxt app hosted on a root domain.
Some parts of the app are also accessible via subdomains (or even different domains).

To make assets and API calls work properly across all domains, I’ve set:

.env

BASE_URL="http://labaxxxxxxxxx.fr"

nuxt.config.ts

{
//...
  app: {
    cdnURL: process.env.BASE_URL
  },
  runtimeConfig: {
    public: {
      baseURL: process.env.BASE_URL,
    }
  },
  experimental: {
    componentIslands: 'local+remote'
  }
//...
}

components/Markdown.server.vue

<Markdown :source="config.public.baseURL"  />

Describe the bug

Everything works as expected on the root domain and even from subdomains for assets and API calls.

However, server components break when accessed from subdomains because their requests seem to be relative, not absolute.

✅ If the page is open from my root domain, everything works as excepted.

https://labaxxxxxxxxx.fr

But if I the page is open from a subdomain:

https://labrasive.labaxxxxxxxxx.fr

✅ The assets or api calls correctly targets the root domain, like this /band:

Image

❌ But the Markdown.server.vue component call is broken because it doesn't target the root domain...

Image

So is there an other way to set a BASE_URL to Server Components, or is it a bug?

Thank you for your help!

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions