Skip to content

Inability to create full location block #3856

@ryan-dyer-sp

Description

@ryan-dyer-sp

Describe the bug
Our app needs to be able to proxy_pass certain locations to external entities. We have an existing nginx config of

location /path {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-Forwarded-Port $server_port;
      proxy_set_header Host $host;
      proxy_read_timeout 600;
      fastcgi_read_timeout 600;
      proxy_pass https://external.url/path/;
}

I've tried creating this as a snippet filter of the http.server.location variety and including it in an httproute like:

      rules:
        - backendRefs:
            - group: ''
              kind: Service
              name: app
              port: 8080
              weight: 1
          matches:
            - path:
                value: /
                type: PathPrefix
        - filters:
            - extensionRef:
                group: gateway.nginx.org
                kind: SnippetsFilter
                name: external-proxy-pass
              type: ExtensionRef
          matches:
            - path:
                type: PathPrefix
                value: /path/

But this results in an invalid nginx configuration due to multiple proxy_pass directives. I'm unable to obtain the config as it is getting rolled back to the last working one.

An additional oddity is that even though the config has been rolled back, ALL HTTPRoutes using this gateway are broken and external-dns in turn wipes all the DNS entries.

To Reproduce
Steps to reproduce the behavior:
see above

Expected behavior
able to create a custom location block

Your environment

  • Version of the NGINX Gateway Fabric - release version or a specific commit. The first line of the nginx-gateway container logs includes the commit info.
    NGF 2.1.0

  • Version of Kubernetes
    1.32.6

  • Kubernetes platform (e.g. Mini-kube or GCP)
    EKS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions