title: What is the Best way to Setup Proxy Pass in an Nginx Ingress object for Kubernetes
body: <p>Currently I am trying to Migrate a site that was living on an Apache Load balanced Server to my k8s cluster. However the application was set up strangely with a proxypass and proxyreversepass like so:</p>
  
  <pre><code>ProxyPass /something http://example.com/something
  ProxyPassReverse /something http://example.com/something
  </code></pre>
  
  <p>And I would like to mimic this in an Nginx Ingress</p>
  
  <p>First I tried using the <code>rewrite-target</code> annotation however that does not keep the <code>Location</code> header which is necessary to get the application running again. </p>
  
  <p>Then I tried to get the <code>proxy-redirect-to/from</code> annotation in place inside a specific location block like so:</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: gpg-app-ingress
    annotations:
      nginx.ingress.kubernetes.io/proxy-redirect-from: http://originalapp.com/something
      nginx.ingress.kubernetes.io/proxy-redirect-to: http://example.com/something
  spec:
    rules:
    - host: example.com
      http:
        paths:
          - path: /something
            backend:
              serviceName: example-com
              servicePort: 80
  </code></pre>
  
  <p>I would like to be able to instead use a custom <code>proxy_pass</code> variable but it doesn't seem like its possible.</p>
  
  <p>What would be the best way to mimic this proxy pass?</p>