thebigk's avatar
Level 13

Multi-tenant App Does Not Recognise Routes from Mapped Domain

I've run into a strange problem while working on my multi-tenant application. My application (my.app) allows users to create their own subdomain (tenant.my.app) and serve it white labeled under their own domain (support.customer.com) ; which is mapped via CNAME to tenant.my.app.

My application works very well for all routes on tenant.my.app. However, when I map the domain and type support.customer.com, my application shows 404. I have checked that the request actually hits my application and I can do a dd($request->getHost()). However, I cannot get any route like support.customer.com/123 to load.

Here's how I've tested in my routes.php

Route::get('/123', function() {
    dd("Hello");
});

Surprisingly, on my local environment which runs valet, I can link any domain like customer.test and get everything to work as expected.

What could be going wrong with this?

PS: FWIW, I have the following in my session.php, to make way for the incoming domain requests. Not sure how safe this is and whether this is contributing to the error. I've tried hard-coding the value to the test domain; but no use.

'domain' = $_server['http_host'],
0 likes
0 replies

Please or to participate in this conversation.