You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I created some API methods for a few of my plugins. I want to return, as part of the header, important information, such as 'expires' and 'maxage'. The thing is that, if I use format=JSON or format=JSON2, the headers are being deleted (and replaced by 'Cache-Control: must-revalidate'). If I make the request using, for example, format=XML, I get the response with the right headers (the ones I defined in the API method of my plugin). Why is this happening? Why the format required is interfering with the headers of the response?
I'm assigning the headers like this:
header("Cache-Control: public, max-age=$maxAge");
Just before the "return" of the method.
Thank you very much.
The text was updated successfully, but these errors were encountered:
eramirezprotec
changed the title
Headers deleted when format=JSON
Headers deleted/replaced when format=JSON
Jan 28, 2020
I consider this issue as an important one: one of the most interesting things when using matomo is the ability to provide APIs that expose metrics already computed and ready to be consumed by an external process.
It is also very interesting to cache those metrics so as not to overwelm the matomo instance, however, this is not possible if the API code is not able to specify the cache control http headers.
Hi! I created some API methods for a few of my plugins. I want to return, as part of the header, important information, such as 'expires' and 'maxage'. The thing is that, if I use format=JSON or format=JSON2, the headers are being deleted (and replaced by 'Cache-Control: must-revalidate'). If I make the request using, for example, format=XML, I get the response with the right headers (the ones I defined in the API method of my plugin). Why is this happening? Why the format required is interfering with the headers of the response?
I'm assigning the headers like this:
header("Cache-Control: public, max-age=$maxAge");
Just before the "return" of the method.
Thank you very much.
The text was updated successfully, but these errors were encountered: