B Seven
B Seven

Reputation: 45943

How to use a Rails form with a CDN?

We are interested in using a CDN (like Cloudflare) for our Rails 4 site (on Heroku), which has a form. Is it possible for the CDN to cache the form?

Each time a Rails form is rendered, it should have a unique authenticity token. So does that preclude it from being cached by a CDN? Are there any ways to make it work with a CDN?

Upvotes: 0

Views: 184

Answers (1)

damoncloudflare
damoncloudflare

Reputation: 2087

CloudFlare caches by file extensions by default

If you're trying to cache something like yoursite.com/form, then you probably want to look at using PageRules to cache the actual page.

Note: I would recommend using caution if you use something like cache everything. You probably want to avoid having cached content intended for one user displayed to another user.

Upvotes: 1

Related Questions