简体   繁体   中英

Laravel + nginx + Subdomain + Load balancer

My wildcard subdomains are not working when I am using a load balancer. I have edited the nginx config so the domain is .xxx.com on both the load balancer and both of my app servers. The servers are setup using Forge .

When I visit a subdomain, the app interprets it as the main domain. For example, visiting subdomain.xxx.com shows me the homepage of xxx.com , and visting subdomain.xxx.com/blog shows me xxx.com/blog (which is a 404). The URL also changes in the browser and doesn't include the subdomain.

The same code works on my staging server, which leads me to believe that the load balancer is causing the issue. I don't have a LB on the staging server.

I have restarted nginx, cleared the route and config cache.

Looking at the request in Telescope , I see that host is set to the domain (not subdomain).

Why is the subdomain not working when using a load balancer?

Turns out the DNS hadn't propagated yet. Weird result.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM