Search code examples
apachereverse-proxymod-proxy

Handling POST requests using Apache's mod_proxy


I am currently hosting 2 web applications on the same Apache server. Let's just call, them A and B. I was using JSONP to make cross domain ajax calls from A to B (I needed some data from B). The problem became apparent with this method when my request got too big and GET simply wouldn't work; I needed to use a POST request.

I installed mod_proxy and configured my Apache web server to act as a reverse proxy as illustrated here: http://bit.ly/rpeWJI . This worked beautifully with GET requests, but I am still unable to get POST requests to work properly. Can someone help me?

As a side note, I am using the Pylons web framework for my web applications.


Solution

  • May I suggest using nginx instead of Apache. Here is an example config:

    http {
        proxy_cache_path  /data/nginx/cache  levels=1:2    keys_zone=STATIC:10m
                                            inactive=24h  max_size=1g;
        server {
            location / {
                proxy_pass             http://1.2.3.4;
                proxy_set_header       Host $host;
                proxy_cache            STATIC;
                proxy_cache_valid      200  1d;
                proxy_cache_use_stale  error timeout invalid_header updating
                                      http_500 http_502 http_503 http_504;
            }
        }
    }