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

Using the version 2.1.0, I'm getting an empty response #52

Closed
andrecarlucci opened this issue Oct 24, 2018 · 2 comments
Closed

Using the version 2.1.0, I'm getting an empty response #52

andrecarlucci opened this issue Oct 24, 2018 · 2 comments

Comments

@andrecarlucci
Copy link

I get the 429, but also an empty response :(
I'm using AspNetCoreRateLimit 2.1.0 with netcoreapp2.2

appsettings.json

"ClientRateLimiting": {
    "EnableEndpointRateLimiting": false,
    "StackBlockedRequests": false,
    "ClientIdHeader": "Pim-Auth",
    "HttpStatusCode": 429,
    "EndpointWhitelist": [
      "get:/index.html",
      "get:/swagger-ui.css",
      "get:/swagger-ui-bundle.js",
      "get:/swagger-ui-standalone-preset.js"
    ],
    "ClientWhitelist": [  ],
    "GeneralRules": [
      {
        "Endpoint": "*",
        "Period": "15m",
        "Limit": 2
      }
    ]
  }

ConfigureServices

            services.AddOptions();
            services.AddMemoryCache();
            services.Configure<ClientRateLimitOptions>(configuration.GetSection("ClientRateLimiting"));

            services.AddSingleton<IClientPolicyStore, MemoryCacheClientPolicyStore>();
            services.AddSingleton<IRateLimitCounterStore, MemoryCacheRateLimitCounterStore>();

Configure (first line)

app.UseClientRateLimiting();

Any thoughts?

@sharyex
Copy link

sharyex commented Oct 25, 2018

Try setting the QuotaExceededMessage option in the json config.
This is where the message is handled if you want to fiddle with it: ReturnQuotaExceededResponse

Working fine for me in .NET Core 2.1, tho I had to modify the project and compile it myself to resolve some dependency warnings instead of using the nuget package, maybe something breaks for 2.2, try self compiling it as well.

@andrecarlucci
Copy link
Author

@sharyex, setting QuotaExceededMessage did the trick, thanks!

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

No branches or pull requests

2 participants