Created
May 19, 2016 23:35
-
-
Save sepiariver/74f5534b110b5dc08a527f7cc74f0c29 to your computer and use it in GitHub Desktop.
Web Rules (nginx conf) in MODX Cloud for CDN, proxy caching assets, and statcache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# statcache bits | |
set $cache_prefix 'statcache'; | |
if ($http_user_agent = 'MODX RegenCache') { | |
set $cache_prefix 'no cache'; | |
} | |
# CORS for CDN pull zone and expires directives | |
location ~* \.(?:ico|css|js|jpe?g|png|gif|svg|pdf|mov|mp4|mp3|woff|woff2|ttf|ttc|otf|eot|font.css)$ { | |
expires 7d; | |
add_header Access-Control-Allow-Origin "*"; | |
add_header Pragma public; | |
add_header Cache-Control "public"; | |
gzip_vary on; | |
} | |
# modified modx rewrite for statcache | |
location / { | |
try_files /$cache_prefix$uri~index.html /$cache_prefix$uri $uri $uri/ @modx-rewrite; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment