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

[Feature] Access rule's upstream.url to support Go templates #1216

Open
5 tasks done
rrmistry opened this issue Jan 15, 2025 · 0 comments
Open
5 tasks done

[Feature] Access rule's upstream.url to support Go templates #1216

rrmistry opened this issue Jan 15, 2025 · 0 comments
Labels
feat New feature or request.

Comments

@rrmistry
Copy link

rrmistry commented Jan 15, 2025

Preflight checklist

Ory Network Project

No response

Describe your problem

Currently, if I set a Go template in the access rule's upstream.url property then it does not evaluate Go templates.

A simple example confirmed using:

// access-rules.json
[
  {
    "upstream": {
      "url": "http://apisix-data-plane:80/{{ print .Subject }}",
    },
    // ... other properties
  }
]

Results in the upstream receiving this url:

GET /%7B%7B%20print%20.Subject%20%7D%7D/my-app

When I expected the upstream to recieve:

GET /rohit/my-app

This is an elementary example, but the intention is to use more complex scenarios e.g.

http://my-apps-{{ printIndex .MatchContext.RegexpCaptureGroups 0 | title }}:80/api/{{ printIndex .MatchContext.RegexpCaptureGroups 1 | title }}/my-entity

Describe your ideal solution

The ideal solution would allow implementing Go templates in the Upstream URL so that we can have more dynamic paths and routing.

Workarounds or alternatives

So far, we are using APISIX as an API gateway with its proxy-rewrite plugin to implement a similar behavior. However, this adds an extra hop and is not an ideal long-term solution.

Version

oryd/oathkeeper:v0.40.8

Additional Context

No response

@rrmistry rrmistry added the feat New feature or request. label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request.
Projects
None yet
Development

No branches or pull requests

1 participant