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

"DisableRateLimitHeaders": false is not showing X-Rate-Limit and Retry-After headers in response #1305

Open
neetra opened this issue Jul 29, 2020 · 5 comments · May be fixed by #1307
Open
Assignees
Labels
accepted Bug or feature would be accepted as a PR or is being worked on bug Identified as a potential bug Rate Limiting Ocelot feature: Rate Limiting Summer'24 Summer 2024 release
Milestone

Comments

@neetra
Copy link

neetra commented Jul 29, 2020

Expected Behavior / New Feature

configuration file:

{
"Routes" :  [  {
      "DownstreamPathTemplate": "/users",
      "DownstreamScheme": "https",
      "DownstreamHostAndPorts": [
        {
          "Host": "jsonplaceholder.typicode.com",
          "Port": 443
        }
      ],
      "UpstreamPathTemplate": "/users",
      "UpstreamHttpMethod": [ "Get" ],
      "RateLimitOptions": 
        {
          "ClientWhitelist": [],
          "EnableRateLimiting": true,
          "Period": "10s",
          "PeriodTimespan": 3,
          "Limit": 1
        }
      


    }],

  "GlobalConfiguration": {
   
    "RateLimitOptions": {
      "DisableRateLimitHeaders": true,
      "QuotaExceededMessage": "Exceed ",
      "HttpStatusCode": 602
    }

}

Response headers should contain X-Rate-Limit and Retry-After headers as mentioned in [document](https://ocelot.readthedocs.io/en/latest/features/ratelimiting.html)

Actual Behavior / Motivation for New Feature

image
It does not contain response headers.

Specifications

  • Version:
@jlukawska
Copy link
Contributor

Hello,
as I see the problem is caused by the recent changes in the code. Now httpcontext is used in a different way than before, more: there is a new httpcontext created for each request...
I have an idea how to fix it, so I'm going to create a PR soon.

@jlukawska jlukawska linked a pull request Jul 31, 2020 that will close this issue
@neetra
Copy link
Author

neetra commented Aug 5, 2020

Thanks @jlukawska

@nls44
Copy link

nls44 commented Apr 6, 2021

+1, X-Rate-Limit and Retry-After headers are not set. Would be handy if this could get fixed since Polly supports automatic retries based on this header.

@garybond
Copy link

+1. Just updated my project from netcore3.1 to net5.0 Ocelot v17.0.0 and this breaks rate-limiting on a partner-facing api we host, as it no longer emits the required headers. I've also tried it on net6.0 Ocelot v18.0.0 and same issue.

@raman-m raman-m added bug Identified as a potential bug accepted Bug or feature would be accepted as a PR or is being worked on labels Aug 2, 2023
@raman-m
Copy link
Member

raman-m commented Aug 2, 2023

+ Accepted

...due to the open PR #1307 by @jlukawska

@raman-m raman-m added Rate Limiting Ocelot feature: Rate Limiting Summer'24 Summer 2024 release labels Apr 30, 2024
@raman-m raman-m changed the title RateLimiting : {"DisableRateLimitHeaders": false} is not showing X-Rate-Limit and Retry-After headers in response "DisableRateLimitHeaders": false is not showing X-Rate-Limit and Retry-After headers in response Apr 30, 2024
@raman-m raman-m added this to the May-June'24 milestone Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Bug or feature would be accepted as a PR or is being worked on bug Identified as a potential bug Rate Limiting Ocelot feature: Rate Limiting Summer'24 Summer 2024 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants