Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dbfx's avatar
Level 1

Multiple domains & Laravel Vapor

Hi all

I have configured multiple domains for a site by adding two to vapor.yml which is working perfectly fine. My primary domain, and a new second domain that I want to expose certain routes on.

I can get to it, but it's just a 404 page. However, I cannot find a way to configure my routes or app to actually serve pages there.

I have two routes to match it, one with a domain() rule and one general one. Neither work on the second domain.

Route::domain('new.domain.com')->group(function () {
    Route::get('/s/{runId}/{key}', [RunController::class, 'shareReport'])->name('run.shareReport');
});

Route::get('/s/{runId}/{key}', [RunController::class, 'shareReport'])->name('run.shareReport');

If I print out url()->current() on my 404 page I see this:

https:/s/6065/57fa920f0cf9b46121881f815876924dcd09fb1b39ca1a6941b22d6add382f81

So it has the url but no domain at all. On the first primary url that would have my domain. Anyone got any ideas or experience?

Thank you!

0 likes
2 replies
dbfx's avatar
dbfx
OP
Best Answer
Level 1

Heads up this was due to the TrustedHosts middleware

Please or to participate in this conversation.