title: Nginx reverse proxy does not change the host
body: <p>When I use Nginx reverse proxy with my Angular app the host does not change at all. It tries to call the path but with the same url (localhost).</p>
  
  <p>In the folder /etc/nginx/servers I have myAppProxy.conf with the configuration you can see bellow. Obviously, in the nginx.conf I include that path (include servers/*;).</p>
  
  <p>From angular I call that path /ag-rcc-cardcontrols/controls, so that the nginx proxy should redirect to <a href="https://whatever.com/ag-rcc-cardcontrols/controls" rel="nofollow noreferrer">https://whatever.com/ag-rcc-cardcontrols/controls</a>. However, I get an error response where I can see that the URl is <a href="http://localhost/ag-rcc-cardcontrols/controls" rel="nofollow noreferrer">http://localhost/ag-rcc-cardcontrols/controls</a>.</p>
  
  <p>So, I think the reverse proxy is not working.</p>
  
  <h2>myAppProxy.conf</h2>
  
  <pre><code>server {
    listen 80 default_server;
  
    root /Users/e1205577/Documents/Workspace/card-controls-rcc-screen/dist/card-controls-rcc-screen;
  index index.html index.htm;
  
    location / {
       try_files $uri $uri/ /index.html;
    }
  
    location /ag-rcc-cardcontrols/ {
       # proxy_bind 127.0.0.1;
       proxy_pass https://whatever.com;
       proxy_pass_request_headers on;
       proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
       proxy_set_header Host $host;
       proxy_redirect off;
       proxy_buffering off;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Strict-Transport-Security "'max-age=31536000; includeSubDomains' always";
       proxy_set_header X-Frame-Options "SAMEORIGIN";
       proxy_set_header X-XSS-Protection "1; mode=block";
       proxy_set_header X-Content-Type-Options "nosniff";
       proxy_set_header Referrer-Policy "'strict-origin-when-cross-origin' always";
       proxy_set_header Cache-Control "'no-cache, no-store, must-revalidate' always";
       proxy_set_header Pragma "no-cache";
    }
  }
  </code></pre>
  
  <h2>Angular code</h2>
  
  <pre><code>handlePostRequest(url: string) {
    url = '/ag-rcc-cardcontrols/controls';
  
    const headers = new HttpHeaders({
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'Client-id': 'client id',
      'Application-Id': 'app id',
    });
  
    return this.httpClient.post&lt;Object&gt;(url, '{"ignoreRecurring": true}', {'headers': headers}).subscribe(
      response =&gt; {
        console.log(response);
      },
      (error: HttpErrorResponse) =&gt; {
        console.log(error);
      }
    );
  }
  </code></pre>