Caddy Re-write Rule support
-
Hi, I’ve change my web server from Nginx to Caddy.
So I’ve to change my config.
Since Caddy does not support environment variables, Could you help me to complete my code?I don’t know how to pass the right parameter for mobile devices.
try_files @mobile /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?{query}{???ENV:WPP_MOBILE_EXT???}
This is my code:
(wppcache) { header Vary Accept-Encoding @mobile { header_regexp User-Agent Mobile|Android|Kindle|BlackBerry|Opera\sMini|Opera\sMini } @is-gzip { file path *.html_gz *.html_mobile_gz *.html_amp_gz *.html_mobile_amp_gz } header @is-gzip { Content-Type text/html Content-Encoding gzip } @no-gzip { file not path *.html_gz *.html_mobile_gz *.html_amp_gz *.html_mobile_amp_gz } @cache { not header_regexp Cookie "wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in|wptouch_switch_toggle|comment_author_|comment_author_email_" not path_regexp "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(index)?.xml|[a-z0-9-]+-sitemap([0-9]+)?.xml)" not method POST not expression {query} != '' } route @cache { try_files /wp-content/cache/wpp-cache/{host}{uri}/index.html {path} {path}/index.php?{query} } } domain.com { # Change the path here according to your setup root * /var/www/domain.com file_server # Change the path here according to your server php_fastcgi unix//run/php/php7.4-fpm.sock import wppcache encode @no-gzip zstd gzip }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Caddy Re-write Rule support’ is closed to new replies.