ThreeMammals / Ocelot

.NET API Gateway

Home Page:https://www.nuget.org/packages/Ocelot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request Body Not Considered in Ocelot Cache Key Calculation

mertgundoganx opened this issue · comments

I am using Ocelot in my .NET project and have recently implemented a new caching mechanism. However, I have encountered an issue where Ocelot is using the same cache key for different requests even though the request bodies are different. As a result, different requests are returning the same response.

Specifications

  • Version: 23.2.2 on .NET 6

Hello, Mert!
It's great to know that you've incorporated Ocelot into your products!

As for the caching issue...

I am using Ocelot in my .NET project and have recently implemented a new caching mechanism.

Please note that we cannot be held accountable for hybrid solutions if modifications have been made to Ocelot services.

I have encountered an issue where Ocelot is using the same cache key for different requests even though the request bodies are different.

It's important to note that the cache key is generated based on the route definition, which includes paths, service names, HTTP verbs, etc. For a more effective analysis, could you please provide your ocelot.json file? Regarding the cache versus load balancing keys, we have addressed this in the past with:

The aforementioned fix was included in the release of version 23.1.0, which you can find here: 23.1.0


Regarding body hashing for cache keys, we have implemented a fix:

This fix will be included in the upcoming release, version 23.3, which is scheduled for release in a few days. Please look out for the new version!
If you require the bug fix urgently, you may fork the repository and compile the DLL manually in Visual Studio.

Is there anything else I can assist with?

Regarding body hashing for cache keys, we have implemented a fix:

This fix will be included in the upcoming release, version 23.3, which is scheduled for release in a few days. Please look out for the new version! If you require the bug fix urgently, you may fork the repository and compile the DLL manually in Visual Studio.

Is there anything else I can assist with?

Thank you for your answer. I'm impatiently waiting for the new version

Bugfix #2058 is now available in the 23.3.0 pre-release!

The Ocelot 23.3.0 package can be downloaded from NuGet for dotnet restore right today. The official 23.3 release is expected to be finalized within a few days, likely by Monday.
This issue will be closed accordingly...

Duplicate of #2059

Already fixed by #2058
Delivered as a part of release: 23.3.0
Commit → 6e9a975
NuGet package with the fix: Ocelot.23.3.0

@mertgundoganx
Please, upgrade to v23.3.0+
Docs: EnableContentHashing option

@mertgundoganx Please, upgrade to v23.3.0+ Docs: EnableContentHashing option

I upgraded version and made the changes immediately. It happened the way I wanted. Thanks again