title: Laravel + nginx + Subdomain + Load balancer
body: <p>My wildcard subdomains are not working when I am using a load balancer. I have edited the nginx config so the domain is <code>.xxx.com</code> on both the load balancer and both of my app servers. The servers are setup using <em>Forge</em>.</p>
  
  <p>When I visit a subdomain, the app interprets it as the main domain. For example, visiting <code>subdomain.xxx.com</code> shows me the homepage of <code>xxx.com</code>, and visting <code>subdomain.xxx.com/blog</code> shows me <code>xxx.com/blog</code> (which is a 404). The URL also changes in the browser and doesn't include the subdomain.</p>
  
  <p>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.</p>
  
  <p>I have restarted nginx, cleared the route and config cache.</p>
  
  <p>Looking at the request in <em>Telescope</em>, I see that <code>host</code> is set to the domain (not subdomain).</p>
  
  <p>Why is the subdomain not working when using a load balancer?</p>