Support the ongoing development of Laravel.io →
Laravel Octane Routing

Hello,

I have currently a weird setup, my Laravel Octane listen to 127.0.0.1:8000 and I have an nginx in front of my app. For some internal purposes, we have to serve each internal app into a subdirectory:

  • app1 (127.0.0.1:8000) => nginx_ip/app1
  • app2 (10.0.0.XXX:8000) => nginx_ip/app2
  • app3 (10.0.0.XXX:8000) => nginx_ip/app3 This works fine on some apps, but with Laravel Octane, it does not detect the "/appXX" in the URL, so generated route and assets URL are "nginx_ip/route/url" instead of "nginx_ip/appXX/route/url". My nginx proxy is like this:
location /app1 {
    allow xxx.xxx.xxx.xxx/xx;
    deny all;

    set $suffix "";
    if ($uri = /index.php) {
        set $suffix ?$query_string;
    }
    
    proxy_pass         http://127.0.0.1:8000$suffix;
    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection $connection_upgrade;
    proxy_http_version 1.1;
    proxy_set_header   Host $host;
    proxy_set_header   Proxy "";
    proxy_set_header   Referer $http_referer;
    proxy_set_header   X-Forwarded-For $remote_addr;
    proxy_set_header   X-Forwarded-Host $host;
    proxy_set_header   X-Forwarded-Port $server_port;
    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_set_header   X-Forwarded-Server $host;
}

Basically the nginx proxy as described in Laravel docs. The Laravel Octane service detects correctly / when I query nginx_ip/app1/ :

jun 20 10:24:16 myserver php[745266]: 200    GET / ............................................... 23.19 mb 5.14 ms

Is there something I did wrong?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.