0
@@ -369,6 +369,8 @@ public:
0
mapToStorage(request_rec *r) {
0
DirConfig *config = getDirConfig(r);
0
if (determineRailsBaseURI(r, config) == NULL
0
|| fileExists(r->filename)) {
0
@@ -376,32 +378,48 @@ public:
0
* If the file already exists, serve it directly.
0
* This is for static assets like .css and .js files.
0
+ forwardToRails = false;
0
+ } else if (r->method_number == M_GET) {
0
char *html_file = apr_pstrcat(r->pool, r->filename, ".html", NULL);
0
if (fileExists(html_file)) {
0
/* If a .html version of the URI exists, serve it directly.
0
- *
This is used by page caching.
0
+ *
We're essentially accelerating Rails page caching.
0
r->filename = html_file;
0
r->canonical_filename = html_file;
0
+
forwardToRails = false;
0
- /* Apache's default map_to_storage process does strange
0
- * things with the filename. Suppose that the DocumentRoot
0
- * is /website, on server http://test.com/. If we access
0
- * http://test.com/foo/bar, and /website/foo/bar does not
0
- * exist, then Apache will change the filename to
0
- * /website/foo instead of the expected /website/bar.
0
- * We make sure that doesn't happen.
0
- * Incidentally, this also disables mod_rewrite. That is a
0
- * good thing because the default Rails .htaccess file
0
- * interferes with Passenger anyway (it delegates requests
0
- * to the CGI script dispatch.cgi).
0
+ forwardToRails = true;
0
+ * Non-GET requests are always forwarded to Rails.
0
+ * This important because of REST conventions, e.g.
0
+ * 'POST /foo' maps to 'FooController.create',
0
+ * while 'GET /foo' maps to 'FooController.index'.
0
+ * We wouldn't want our page caching support to interfere
0
+ forwardToRails = true;
0
+ /* Apache's default map_to_storage process does strange
0
+ * things with the filename. Suppose that the DocumentRoot
0
+ * is /website, on server http://test.com/. If we access
0
+ * http://test.com/foo/bar, and /website/foo/bar does not
0
+ * exist, then Apache will change the filename to
0
+ * /website/foo instead of the expected /website/bar.
0
+ * We make sure that doesn't happen.
0
+ * Incidentally, this also disables mod_rewrite. That is a
0
+ * good thing because the default Rails .htaccess file
0
+ * interferes with Passenger anyway (it delegates requests
0
+ * to the CGI script dispatch.cgi).
Comments
No one has commented yet.