Skip to content

Instantly share code, notes, and snippets.

@ehoch
Created December 19, 2014 22:22
Show Gist options
  • Save ehoch/d7b4e40b59eb446c6a55 to your computer and use it in GitHub Desktop.
Save ehoch/d7b4e40b59eb446c6a55 to your computer and use it in GitHub Desktop.
Fastly ESI CSRF Token for Spree
...
def csrf_meta_tags
render layout: false
end
...
# Replace CSRF token with ESI
Deface::Override.new(virtual_path: 'spree/shared/_head',
name: 'csrf_token',
replace: "erb[loud]:contains('csrf_meta_tags')",
text: '<esi:include src="/csrf_meta_tags.html" />')
get '/csrf_meta_tags' => 'application#csrf_meta_tags'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment