Hi there. I've just started a new app that runs with a wildcard subdomain. So, I'm going to be rendering foo.com
, bar.foo.com
, and many many other subdomains pointing to the same nuxt.js server instance.
I'm looking for a way for my most root-y of pages
, index.vue
, to be able to distinguish if it's running on the main domain foo.com
, or if it's on one of our zillions of subdomains.
I understand that created
is the best lifecycle event to grab this info, but obviously window.location
only exists on the client side. I cannot, for the life of me, figure out how I might distinguish what domain name was used when the page is rendered on the Server Side.
I've poked around at process
, but I'm not sure what the right place is.
So, basically:
created () {
if (process.browser) {
console.log(window.location)
} else {
console.log('*****')
// console.log(something_something_something)
console.log('*****')
}
}
and this is where I'm stuck. Help most welcome—I've gone through the docs and searched all open and closed issues (but it's possible I didn't use the right search terms).
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2069">#c2069</a>)</em></sub></div>