Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

URLRewrite support #233

Closed
manobi opened this issue Jun 17, 2022 · 5 comments · Fixed by #282
Closed

URLRewrite support #233

manobi opened this issue Jun 17, 2022 · 5 comments · Fixed by #282
Labels
runtime/kubernetes Deployed on self-managed Kubernetes theme/k8s-gateway-api Related to the Kubernetes Gateway API standard type/enhancement New feature or request

Comments

@manobi
Copy link

manobi commented Jun 17, 2022

Is your feature request related to a problem? Please describe.

HTTPRoute URLRewrite filter support is a deal breaker for the company I work for.
I have tried to use it following Gateway API spec, but had no success.

The supported features doc does not confirm support as well.

Is it actually supported or planned?

Feature Description

Use Case(s)

Given that "/orders" redirect to order service
When I reach "/orders/10"
Then orders service request path must be "/10"
And request path should not have "/orders" prefix

apiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
  name: orders
  namespace: consul
spec:
  parentRefs:
  - name: api-gateway
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /orders
      backendRefs:
        - kind: Service
          name: orders
          namespace: orders
          port: 80
          weight: 100
      filters:
        - type: URLRewrite
          urlRewrite:
            path:
              type: replacePrefixMatch
              value: /orders

Contributions

@Jeff-Apple Jeff-Apple added the type/enhancement New feature or request label Jun 17, 2022
@Jeff-Apple
Copy link
Contributor

Jeff-Apple commented Jun 17, 2022

Hi @manobi,

URL Path Rewrite is not supported at this time, but we do plan to support it in a release in the next 2-4 months. As always, plans can change so this isn't a guaranty that we will support it that time frame.

Can you describe what type(s) of rewrite you need to do? Some examples are changing the prefix (beginning of the path), changing the postfix (such as a file extension) or, doing a RegEx match and replace. Any other details you're willing to share will be helpful as we do our final planning for this feature.

Regards,
Jeff

@manobi
Copy link
Author

manobi commented Jun 18, 2022

Hi @Jeff-Apple,
I believe prefix drop (replacePrefixMatch) would solve a lot of use cases we have right now, and forward Consul adoption to the next level.

Do you think we can make that work in service level somehow (service-router maybe), while waiting for official support in gateway level?

Thank you.

@nathancoleman
Copy link
Member

nathancoleman commented Jul 13, 2022

Hi @manobi ,
I meant to reply and got distracted, my bad.

There's not currently a workaround that I'd feel comfortable recommending since any direct modification you might make to the Consul config to control gateway routing could potentially be overwritten by the Consul API Gateway controller.

As Jeff mentioned, official support for prefix rewrite is planned for a near-term release 😉

#282

@nathancoleman nathancoleman added theme/k8s-gateway-api Related to the Kubernetes Gateway API standard runtime/kubernetes Deployed on self-managed Kubernetes labels Jul 13, 2022
@nathancoleman nathancoleman linked a pull request Jul 13, 2022 that will close this issue
2 tasks
@Jeff-Apple
Copy link
Contributor

@manobi , We now support rewriting the URL Path Prefix in Consul API Gateway v0.4.0. This is configured by adding a urlRewrite filter to an HTTPRoute. You can find the details in our product documentation for routes

@manobi
Copy link
Author

manobi commented Aug 17, 2022

@manobi , We now support rewriting the URL Path Prefix in Consul API Gateway v0.4.0. This is configured by adding a urlRewrite filter to an HTTPRoute. You can find the details in our product documentation for routes

Thank you @Jeff-Apple I'll try it as soon as next week.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
runtime/kubernetes Deployed on self-managed Kubernetes theme/k8s-gateway-api Related to the Kubernetes Gateway API standard type/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants