Skip to content

"nginx.org/rewrites" requires a very strict format; can it be relaxed? #388

Closed
@ronchalant

Description

@ronchalant

Is your feature request related to a problem? Please describe.
nginx.org/rewrites rules formatting is very strict - you cannot have a whitespace before the serviceName when multiple rules are entered.

For example if it's defined this way:

"serviceName=a rewrite=/a; serviceName=b rewrite=/b;serviceName=c rewrite=/c"

Then a and c are picked up, but because the b rule has a leading space it doesn't get picked up.

Describe the solution you'd like
It would be good to have this strict-formatting relaxed a bit, supporting the existing semicolon-separated strings with better handling of whitespaces, but also perhaps other native-YAML array formats.

Some samples/suggestions below:

Multiline string

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    nginx.org/rewrites: >
      serviceName=a rewrite=/a;
      serviceName=b rewrite=/b;
      serviceName=c rewrite=/c;

if the existing rule definitions were maintained but whitespaces were better handled the above would be usable

As YAML array of objects

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    nginx.org/rewrites: 
    - serviceName: a 
      rewrite: "/a"
    - serviceName: b
      rewrite: "/b"
    - serviceName: c 
      rewrite: "/c"

Describe alternatives you've considered
It works as-is if you remove white-spaces, but if you have many rules it becomes harder to read/manager.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementPull requests for new features/feature enhancementsproposalAn issue that proposes a feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions