|Apache Handler to convert POST url to GET url|
| 3:45 am on Jun 23, 2010 (gmt 0)|
How do I convert POST url to GET url?
Due to heavy server load, I am trying to bypass Rails framework and read the cached html file to render for a POST request (I know all the issues with it but it is really out of my hand).
I will like to read POST data, then pick few variables out of it and make a url path to read file from the disk.
How should I do that?
| 2:37 pm on Jun 24, 2010 (gmt 0)|
OK< I'll have a go...
You'll likely need to rewrite all requests for which a cached version might exist to a small script.
The script should look for the cached version, and if it exists, open it, "include" or "require" it and serve it, along with a 200-OK server status (also look at adding further logic here to handle Last-Modified, If-Modified-Since, and 304 responses).
If the cached version does not exist, open, include, and serve the non-cached page, along with a 200-OK response (again, look at supporting 304 responses here). In addition, and if desired, this case should invoke the process to generate a new cached version, so that the *next* request for this resource can be served from cache.
If neither the cached nor non-cached versions exist, serve a 404-Not found response and exit.
When working on the "If-Modified-Since" logic, be aware that with the method outlined above, you will need to look at the Last-Modified date of both the cached and non-cached versions before serving the cached version, to avoid certain 'race conditions' where a second request comes in *while* the cached version is being updated from a new non-cached version. In this case, the cached version will be older than the non-cached version and should likely not be served.