ThreeMammals / Ocelot

.NET API Gateway
https://www.nuget.org/packages/Ocelot
MIT License
8.24k stars 1.62k forks source link

Request Body Not Considered in Ocelot Cache Key Calculation #2087

Closed mertgundoganx closed 1 month ago

mertgundoganx commented 1 month ago

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

raman-m commented 1 month ago

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?

mertgundoganx commented 1 month ago

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

raman-m commented 1 month ago

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...

raman-m commented 1 month ago

Duplicate of #2059

raman-m commented 1 month ago

Already fixed by #2058 Delivered as a part of release: 23.3.0 Commit → https://github.com/ThreeMammals/Ocelot/commit/6e9a975fae3b26229c3f0b3c1a475a7b05e95fee NuGet package with the fix: Ocelot.23.3.0

raman-m commented 1 month ago

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

mertgundoganx commented 1 month ago

@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