<?xml version="1.0" encoding="UTF-8"?>
<blog-post>
  <blog-id type="integer">1</blog-id>
  <body>&lt;p&gt;If you used page caching in a site that implements RESTful interface, you may face a problem. You could have multiple actions that share a single URL with different HTTP methods. For example, showing a document is served at /documents/1, while updating the same document is also at /documents/1. When I'm trying to update a document, the request is something like&lt;br /&gt;
&lt;br /&gt;
PUT /documents/1&lt;br /&gt;
&lt;br /&gt;
If your Apache is not well configured, it may respond with a cached file at /documents/1.html. This is wrong because this file should be served for GET requests only. In fact, POST, PUT and DELETE actions should never be cached because they change server state. Investigating in this issue, I found the following snippet at my .htaccess file.&lt;/p&gt;
&lt;p&gt;===================READ MORE===================&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Conditions for fastcgi&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; RewriteRule ^$ index.html [QSA]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; RewriteRule ^([^.]+)$ $1.html [QSA]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]&lt;br /&gt;
&lt;br /&gt;
To solve this problem I changed a line and added a new line to make it like this&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Conditions for fastcgi&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; RewriteRule ^$ index.html [QSA]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; RewriteRule ^([^.]+)$ $1.html [QSA]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; RewriteCond %{REQUEST_FILENAME} !-f&lt;strong&gt; &lt;span style=&quot;color: rgb(51, 153, 102);&quot;&gt;[OR]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; RewriteCond %{THE_REQUEST} !^GET&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]&lt;br /&gt;
&lt;br /&gt;
This allows a request to served from file system only when the request is a GET request. This resolved the problem.&lt;/p&gt;</body>
  <category-id type="integer">3</category-id>
  <comments-closed type="boolean" nil="true"></comments-closed>
  <created-at type="datetime">2010-02-03T08:49:38Z</created-at>
  <fck-created type="boolean">true</fck-created>
  <id type="integer">10</id>
  <is-complete type="boolean">true</is-complete>
  <posted-by-id type="integer">5</posted-by-id>
  <tag-string>ruby, rails, apache, caching, htaccess</tag-string>
  <title>Skipping cache for POST actions in Apache</title>
  <updated-at type="datetime">2010-02-14T12:02:42Z</updated-at>
  <url-identifier>2010/2/3/skipping-cache-for-post-actions-in-apache</url-identifier>
</blog-post>
