Answers: <p>The solution was to apply this to the vsr.</p>
  <pre><code>  subroutes:
      - path: /
        action:
          proxy:
            upstream: example-service
            requestHeaders:
              set:
              - name: Host
                value: &lt;target fqdn&gt;
              - name: Origin
                value: http://&lt;target fqdn&gt;
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2024-01-16T18:11:40.973Z
Answers: 2024-01-16T22:14:47.953Z
Answers: 2024-01-16T22:14:47.953Z
Answers: flyerhawk
Body: <p>I have a kinda weird set up where I have a general url(<a href="http://www.example.com" rel="nofollow noreferrer">www.example.com</a>) that terminates on an F5 that points to a nginx VS on an EKS cluster that has a localized domain(<a href="http://www.ue1.example.com" rel="nofollow noreferrer">www.ue1.example.com</a>).</p>
  <p>So the flow is user --&gt;&gt; <a href="http://www.example.com" rel="nofollow noreferrer">www.example.com</a> --&gt; F5 --&gt; F5 xforwards host header of <a href="http://www.ue1.example.com" rel="nofollow noreferrer">www.ue1.example.com</a> --&gt; nginx vs --&gt; web service that is licenses for <a href="http://www.example.com" rel="nofollow noreferrer">www.example.com</a>.</p>
  <p>nginx needs a host of <a href="http://www.ue1.example.com" rel="nofollow noreferrer">www.ue1.example.com</a> but then convert it to <a href="http://www.example.com" rel="nofollow noreferrer">www.example.com</a> before sending it to the web service.</p>
  <p>So is there a way to route to a virtulserverroute AND proxy the host header as well. Here are the relevant configs. Not sure where to put the proxy information.</p>
  <pre><code>apiVersion: k8s.nginx.org/v1
  kind: VirtualServer
  metadata:
    name: example
  spec:
    host: example.ue1.eexchange.com
    routes:
      - path: /
        route: example/example
  
  apiVersion: k8s.nginx.org/v1
  kind: VirtualServerRoute
  metadata:
    name: example
  spec:
    upstreams:
      - name: example-service
        service: example
        port: 80
    subroutes:
      - path: /
        action:
          pass: example-service
  
  </code></pre>
  
Tags: <kubernetes><ingress-nginx>
Title: Using route and proxy with a NGINX virtualserver K8s config
UserDisplayName: flyerhawk
ThreadText: # Using route and proxy with a NGINX virtualserver K8s config
  
  (Asked by: username_0 on 2024-01-14)
  
  I have a kinda weird set up where I have a general url([www.example.com](http://www.example.com)) that terminates on an F5 that points to a nginx VS on an EKS cluster that has a localized domain([www.ue1.example.com](http://www.ue1.example.com)).
  
  So the flow is user -->> [www.example.com](http://www.example.com) --> F5 --> F5 xforwards host header of [www.ue1.example.com](http://www.ue1.example.com) --> nginx vs --> web service that is licenses for [www.example.com](http://www.example.com).
  
  nginx needs a host of [www.ue1.example.com](http://www.ue1.example.com) but then convert it to [www.example.com](http://www.example.com) before sending it to the web service.
  
  So is there a way to route to a virtulserverroute AND proxy the host header as well. Here are the relevant configs. Not sure where to put the proxy information.
  
  ```
  apiVersion: k8s.nginx.org/v1
  kind: VirtualServer
  metadata:
    name: example
  spec:
    host: example.ue1.eexchange.com
    routes:
      - path: /
        route: example/example
  
  apiVersion: k8s.nginx.org/v1
  kind: VirtualServerRoute
  metadata:
    name: example
  spec:
    upstreams:
      - name: example-service
        service: example
        port: 80
    subroutes:
      - path: /
        action:
          pass: example-service
  
  ```
  
  **Tags:** kubernetes, ingress-nginx
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2024-01-16. Score: 0
  
  The solution was to apply this to the vsr.
  
  ```
    subroutes:
      - path: /
        action:
          proxy:
            upstream: example-service
            requestHeaders:
              set:
              - name: Host
                value: <target fqdn>
              - name: Origin
                value: http://<target fqdn>
  
  ```
  
  
  ---
  
  