PHP and reverse proxy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kokababu
    New Member
    • Jul 2008
    • 39

    #1

    PHP and reverse proxy

    Hi,

    I have setup a reverse proxy server which will route the request to
    Server B. Proxy server is working well with Server B.

    I would like to catch HTTP status error like 404/500 from server B. If my proxy gets error404/500 from Server B then it will redirect the page to other site, using PHP. For this reason, I set ErrorDocument 404/500 on httpd.conf file in reverse proxy
    server to catch error from Server B. But ErrorDocument is not
    working at all. it is working only if I request local file (in proxy server).

    I would be glad if you kindly advise me how do I catch HTTP
    status error code from Server B and redirect to custom error
    page with requested url, using PHP.

    Thanks
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, kokababu.

    How are you sending the requests? Are you using cURL?

    Comment

    • kokababu
      New Member
      • Jul 2008
      • 39

      #3
      Hi,

      I am not using cURL. I have set Proxypass and ProxyPassRevers e
      in httpd.conf file in my proxy server, let it is called proxyA.

      I have also set a "ErrorDocum ent 404 /senderror.php" in httpd.conf file in proxyA.

      I tested with wrong file name (like: http://www.proxyA.com/path/1111.html),
      1111.html is not in server B so I should get 404 error and ErrorDocument will redirect to senderror.php file but it is not working.

      How do I catch this error and redirect to PHP file with requested URL from proxy server.

      Thanks

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        ProxyErrorOverr ide might help you here (http://httpd.apache.org/docs/2.3/mod...yerroroverride).

        Comment

        • kokababu
          New Member
          • Jul 2008
          • 39

          #5
          Thank you, pbmods. I have played with it and it is working.

          Comment

          • pbmods
            Recognized Expert Expert
            • Apr 2007
            • 5821

            #6
            Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime!

            Comment

            Working...