开发者

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 need开发者_JAVA百科ed 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.


Do you have mod_security enabled in Apache?

I came across your post while debugging why HTTP POST requests were failing against my reverse proxy. (They were receiving a 403 response).

It turned our the server was using mod_security with OWASP settings. Monitoring the error log and then adding application/json to the list of approved types solved it.

I also had to allow PUT requests for similar reasons.


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;
        }
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜