Skip to content

Instantly share code, notes, and snippets.

@agusmu
Forked from gijo-varghese/flying-press.conf
Created October 4, 2020 23:30
Show Gist options
  • Save agusmu/781d4fa73a6e255881aa9ca60de9135f to your computer and use it in GitHub Desktop.
Save agusmu/781d4fa73a6e255881aa9ca60de9135f to your computer and use it in GitHub Desktop.
Nginx Config for FlyingPress
location ~* \.html$ {
add_header x-flying-press-cache HIT;
add_header x-flying-press-source Nginx;
}
set $flying_press_cache 1;
set $flying_press_url "/wp-content/cache/flying-press/$request_uri/index.html";
set $flying_press_file "$document_root/wp-content/cache/flying-press/$request_uri/index.html";
if ($request_method = POST) {
set $flying_press_cache 0;
}
if ($is_args) {
set $flying_press_cache 0;
}
if ($http_cookie ~* "(wp\-postpass|wordpress_logged_in|comment_author|woocommerce_cart_hash|edd_items_in_cart)") {
set $flying_press_cache 0;
}
if (!-f "$flying_press_file") {
set $flying_press_cache 0;
}
if ($flying_press_cache = 1) {
rewrite .* "$flying_press_url" last;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment