I have the following route in my web.php
$parsedUrl = parse_url($appUrl);
$host = $parsedUrl['host'];
Route::domain("{slug}.$host")->group(function () {
Route::get('/', IndexController::class);
});
So when an user access client1.mywebsite.com the 'client1' is passed as the slug to IndexController.
Everything works fine but im trying to use octane and I cant figure it out how to setup my nginx to make it work.
When I dont need to get the subdomain, I usually do this:
location /index.php {
try_files /not_exists @octane;
}
location / {
try_files $uri $uri/ @octane;
}
location @octane {
set $suffix "";
if ($uri = /index.php) {
set $suffix ?$query_string;
}
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header SERVER_PORT $server_port;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://127.0.0.1:8000$suffix;
}
How can I configure my nginx to accept a dynamic subdomain and pass it to octane?
what I did to work was removing this additional "$uri/" at location directive:
FROM
TO
this way octane worked properly with subdomains
heres the full nginx config