Differentiate APIs cache for each XCODE-LANGUAGE on Header

Dear Community,

We are going to implement multi-languages on our mobile application. We use the HTTP header parameter XCODE-LANGUAGE in the API call to differentiate between the three (3) languages used in the application. The backend returns different response contents based on the language indicated in the header request. Note that API responses are returned from the server in JSON format (not as files).

With a single language, we cache responses on Cloudflare, and it works very well. However, with the implementation of multi-languages, we have a serious doubt that Cloudflare will only consider the URL format (which remains unchanged even when the language is different) and will always deliver the same content for every request, without taking the language into account.

Please advise us on the best method for managing multi-language caching for mobile application APIs.

Kind regards

To cache by something other than the URL & Origin header, you would need to use Custom Cache Keys:

This is an Enterprise feature currently, but if you are comfortable with Javascript development you could also do this manually with a Cloudflare Worker that uses the Cache API on any plan:


Thank you Simon
The XCODE-LANGUAGE is a parameter in the Header but it is not a Cache-control Header.

If it’s a request header, it can be included in the custom cache key either via the Enterprise feature or via the Workers Cache API.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.