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
Seeing the contents requested will not change often, we should add cache-control headers to the JSON resources output by the API. This would probably avoid having to check against IP addresses in an attempt to avoid abusive usage of the API. If the JSON resources are generally cached, with an expiration of say 1 month, this should prevent the server from being bombarded by requests from a same IP or domain.
Example:
header('Cache-Control: must-revalidate, max-age=259200'); //revalidate after one month
Should also include an ETag header, which might allow us to extend the cache even longer. The ETag should contain the hash of the response contents (i.e. the hash of the JSON string). The way stylesheets are often handled for example is by changing a hash in the name of the file when the contents change. Here, not having an actual filename, we can set the ETag header with a hash value which will let the client know if the contents have changed.
Seeing the contents requested will not change often, we should add cache-control headers to the JSON resources output by the API. This would probably avoid having to check against IP addresses in an attempt to avoid abusive usage of the API. If the JSON resources are generally cached, with an expiration of say 1 month, this should prevent the server from being bombarded by requests from a same IP or domain.
Example:
Should also include an ETag header, which might allow us to extend the cache even longer. The ETag should contain the hash of the response contents (i.e. the hash of the JSON string). The way stylesheets are often handled for example is by changing a hash in the name of the file when the contents change. Here, not having an actual filename, we can set the ETag header with a hash value which will let the client know if the contents have changed.
The text was updated successfully, but these errors were encountered: