I am trying to add cache support (both HTTP and server) for an ASP.NET Web Api solution.
The solution is in geolocation, which means that I can get different results based on the IP address of the caller.
The issue can be trivially resolved for the server-side cache using an approach similar to VaryByCustom ( like this one ). However, this does not solve the problem with HTTP caches on the client side. Here are the alternatives
I am considering the following options:
Coercion is necessary-revalidate in cache
Save the server side of the validation using the same algorithm as VaryByCustom, but enable additional server side call cache re-processing using ETAGS or any mechanism that tracks the original country of origin of the cache.
Creating country-specific routes for HTTP 302
In this case, the application calling
http:
Redirecting to the US version, if it comes from the US IP address, when the cache expired.
http:
It may contain outdated content that does not match the IP address of the local source. This is not a serious problem if the cache expires, this is a small value (<1 hour), because changes in the country are quite unusual.
What is the recommended solution?
source share