Commit 7610fcb1 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_officejs_appstore_base] Cache the base redirection site in the CDN

Change the caching policy to one hour.

Use the CDN to publish the page if the backend is down

Cache the manifest like the HTML page but force refreshing the manifest to prevent CDN cache inconsistency.
parent b8e153c6
......@@ -170,7 +170,7 @@
<value>
<tuple>
<string>aggregate/web_page_module/gadget_ojs_appstore_redirect_page_html</string>
<string>caching_policy/must-revalidate</string>
<string>caching_policy/one-hour-max-modification-date</string>
</tuple>
</value>
</item>
......@@ -419,7 +419,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.46472.13801.63641</string> </value>
<value> <string>975.65259.47363.59801</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -437,7 +437,7 @@
</tuple>
<state>
<tuple>
<float>1496149454.25</float>
<float>1559055460.25</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -4,13 +4,14 @@ if response is None:
response = REQUEST.RESPONSE
web_section = context
modification_date = max(web_section.Base_getWebDocumentDrivenModificationDate(), DateTime().earliestTime() + (DateTime().hour() /24.0)).rfc822()
if REQUEST.getHeader('If-Modified-Since', '') == web_section.getModificationDate().rfc822():
if REQUEST.getHeader('If-Modified-Since', '') == modification_date:
response.setStatus(304)
return ""
response.setHeader('Content-Type', 'text/cache-manifest')
response.setHeader('Cache-Control', 'max-age=0, public, must-revalidate')
response.setHeader('Cache-Control', 'max-age=600, stale-while-revalidate=360000, stale-if-error=31536000, public')
return """CACHE MANIFEST
# %s + hash""" % context.getLayoutProperty("configuration_latest_version", default="development")
# %s / %s""" % (context.getLayoutProperty("configuration_latest_version", default="development"), modification_date)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment