title: Hot change "Location" in the reply header 302 code from proxy-host.
body: <p>I have the kubernetes-cluster and a few pods/containers with web-app. Pods connecting to each other by pod's name with listen port 9999 (like security-rest-api:9999, common-rest-api:9999, etc).
  To outside listen nginx-pod with outside address <a href="http://e.net:30200/" rel="nofollow noreferrer">http://e.net:30200/</a>. </p>
  
  <p>((app-pods:9999)-(nginx-pod:80)-(nginx-service:30200))-Network</p>
  
  <p>Nginx use follow configuration for interactive with app-pods. </p>
  
  <pre><code>    server {
  
      listen       80;
      server_name  e.net;
  
      location / {
          proxy_pass              http://web-console:9999/;
          proxy_redirect          http://web-console:9999/ http://e.net:30200/;  
      }
  
      location /common {
          proxy_pass              http://common-rest-api:9999/common;
          proxy_redirect          http://common-rest-api:9999/ http://e.net:30200/;  
  
      }
  
      location /security {
          proxy_pass              http://security-rest-api:9999/security;
          proxy_redirect          http://security-rest-api:9999/ http://e.net:30200/;     
  
      } }
  </code></pre>
  
  <p>It's working very well, but I have the one problem with 302-reply from app-pods:</p>
  
  <p>If I try to login in my app, I get follow the 302 reply header:</p>
  
  <pre><code>HTTP/1.1 302 Found
  Connection: keep-alive
  Content-Length: 0
  Date: Wed, 25 Apr 2018 10:37:50 GMT
  Location: http://e.net:30200/security/rest/auth/login.html?callbackUrl=http://security-rest-api:9999/security/rest/namespace
  Server: nginx/1.13.9
  </code></pre>
  
  <p>App-pods generated URL parameter "callbackUrl" from the Host request header Inside containers network and this URL parameter to get to the endpoint browser. Of course, next request get 404 code.</p>
  
  <p>I can't to edit app-code (in app-pods don't use nginx), but I want to change 'security-rest-api:9999' to 'e.net:30200' parameter in the Location 302 reply header. How I can do it?</p>
  
  <p>redirect isn't suitable since this generate new 302-reply and not solve my problem.
  sub_filter change only reply body, but not reply head (where is Location parameter).
  request_uri not working too, since this parameter work with request header only.</p>