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

[TT-10472] CORS.options_passthrough breaks URLRewriteMiddleware #5651

Open
jakub-bochenski opened this issue Oct 19, 2023 · 1 comment
Open

Comments

@jakub-bochenski
Copy link

Branch/Environment/Version

  • Branch/Version: v5.1
  • Environment: On-prem

Describe the bug
If I enable options_passthrough the URLRewriteMiddleware activates but fails to rewrite the URL (see Actual Behaviour).
If I disable options_passthrough the URLRewriteMiddleware activates and rewrites the URL as expected (see Expected Behaviour)

Reproduction steps
Steps to reproduce the behavior:

  1. Add api
  2. Define URL rewrites (also for OPTIONS method)
  3. set CORS.options_passthrough to true

Actual behavior

tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:27:58" level=debug msg=Started api_id=platform api_name=Platform mw=URLRewriteMiddleware org_id=default origin=172.19.0.1 path=/platform/v1/29353/relations/resolved-relations ts=1697732878403807249
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:27:58" level=debug msg="Started proxy"
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:27:58" level=debug msg="Stripping proxy listen path: /platform/"
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:27:58" level=debug msg="Upstream path is: /v1/29353/relations/resolved-relations"

Expected behavior

tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:31:32" level=debug msg=Started api_id=platform api_name=Platform mw=URLRewriteMiddleware org_id=default origin=172.19.0.1 path=/platform/v1/29353/relations/resolved-relations ts=1697733092442978915
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:31:32" level=debug msg="Rewriter active"
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:31:32" level=debug msg="/platform/v1/29353/relations/resolved-relations?include-tags=%5B%7B%22tag%22%3A%22MultiLang%20Configurator%22%2C%22limitPerRelation%22%3A3%7D%5D&limit=3&product-id=043.250S"
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:31:32" level=debug msg="Inbound path: /platform/v1/29353/relations/resolved-relations?include-tags=%5B%7B%22tag%22%3A%22MultiLang%20Configurator%22%2C%22limitPerRelation%22%3A3%7D%5D&limit=3&product-id=043.250S"
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:31:32" level=debug msg="Rewriter checking matches, len is: 1"
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:31:32" level=debug msg="[[/platform/v1/29353/relations/resolved-relations?include-tags=%5B%7B%22tag%22%3A%22MultiLang%20Configurator%22%2C%22limitPerRelation%22%3A3%7D%5D&limit=3&product-id=043.250S 29353 include-tags=%5B%7B%22tag%22%3A%22MultiLang%20Configurator%22%2C%22limitPerRelation%22%3A3%7D%5D&limit=3&product-id=043.250S]]"
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:31:32" level=debug msg="[[$1] [$2]]"
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:31:32" level=debug msg="URL Re-written from: /platform/v1/29353/relations/resolved-relations?include-tags=%5B%7B%22tag%22%3A%22MultiLang%20Configurator%22%2C%22limitPerRelation%22%3A3%7D%5D&limit=3&product-id=043.250S"
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:31:32" level=debug msg="URL Re-written to: search/relations/results/gateway?projectId=29353&include-tags=%5B%7B%22tag%22%3A%22MultiLang%20Configurator%22%2C%22limitPerRelation%22%3A3%7D%5D&limit=3&product-id=043.250S"
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:31:32" level=debug msg=Finished api_id=platform api_name=Platform code=200 mw=URLRewriteMiddleware ns=79317 org_id=default origin=172.19.0.1 path=/platform/v1/29353/relations/resolved-relations
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:31:32" level=debug msg="Started proxy"
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:31:32" level=debug msg="Stripping proxy listen path: /platform/"
tyk-gateway-docker-tyk-gateway-1  | time="Oct 19 16:31:32" level=debug msg="Upstream path is: /search/relations/results/gateway"

Screenshots/Video

Logs (debug mode or log file):
See above

@andyo-tyk andyo-tyk changed the title CORS.options_passthrough breaks URLRewriteMiddleware [TT-10472] CORS.options_passthrough breaks URLRewriteMiddleware Nov 10, 2023
@andyo-tyk
Copy link
Contributor

Hi @jakub-bochenski,

Thanks for flagging this - I've raised a ticket internally and we will take a look at this when we're next in this area of the code.

Thanks again for supporting Tyk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants