Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support regex with "?!" in HTTPProxy #6746

Open
jadefr opened this issue Oct 29, 2024 · 2 comments
Open

Support regex with "?!" in HTTPProxy #6746

jadefr opened this issue Oct 29, 2024 · 2 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/needs-triage Indicates that an issue needs to be triaged by a project contributor.

Comments

@jadefr
Copy link

jadefr commented Oct 29, 2024

I get the following error when creating HTTPProxy with "?!":

  - errors:
    - message: 'route: supplied regex: /lorem/(?!.*\/ipsum)(.*) invalid. error: error
        parsing regexp: invalid or unsupported Perl syntax: `(?!`'
      reason: PathMatchConditionsNotValid
      status: "True"
      type: RouteError

Steps to reproduce:

Deploy yaml:

apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
  name: basic
spec:
  virtualhost:
    fqdn: foo-basic.bar.com
  routes:
    - conditions:
      - regex: /lorem/(?!.*\/ipsum)(.*)
      services:
        - name: s1
          port: 80

I believe using package regexp2 would solve the issue.
As an example, the following PR was done in NGINX Virtual Server: nginxinc/kubernetes-ingress#4465

@jadefr jadefr added kind/feature Categorizes issue or PR as related to a new feature. lifecycle/needs-triage Indicates that an issue needs to be triaged by a project contributor. labels Oct 29, 2024
Copy link

Hey @jadefr! Thanks for opening your first issue. We appreciate your contribution and welcome you to our community! We are glad to have you here and to have your input on Contour. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace

@tsaarni
Copy link
Member

tsaarni commented Oct 29, 2024

Hi @jadefr. the validation Contour does using Go’s regexpshould align with Google’s RE2 engine as used in Envoy. It appears that NGINX uses PCRE, which does support negative lookaheads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/needs-triage Indicates that an issue needs to be triaged by a project contributor.
Projects
None yet
Development

No branches or pull requests

2 participants