HandyHowie
HandyHowie

Reputation: 231

Apache proxypass IP addresses cached

I am using Apache web server 2.4 to proxy incoming HTTP requests to our back-end servers using the proxypass directive. I am also passing outgoing request from our back-end servers through Apache, again using proxypass, e.g.

< Location /outgoingrequest/ >
    ProxyPass http://foobar.com/ retry=0 timeout=40 ttl=60
    ProxyPassReverse http://foobar.com/
< /Location >

This works fine normally, I can see all the incoming and outgoing requests in the Apache log. However foobar.com is hosted in the AWS cloud and occasional its IP address changes, which then causes all outgoing request to fail. A DNS lookup shows the new IP address, so clearly mod-proxy is caching the old IP address. I have added ttl=60, but the outgoing requests keep failing for hours.

Is there something I am missing, or should I be doing this a different way altogether?

Upvotes: 13

Views: 9035

Answers (1)

Doomsday
Doomsday

Reputation: 2668

Have you try to disable the connection pool of Apache entirely with:

ProxyPass http://foobar.com/ retry=0 disablereuse=On

Documentation says:

This helps in various situations (..) when backends themselves may be under round-robin DNS.

Upvotes: 9

Related Questions