[squid-users] FW: Trying to setup Squid as a reverse proxy. Works fine, but when a client does an HTTP POST, Squid claims there's a forwarding error.

Brent Newland brent.newland at casipc.com
Mon Apr 27 16:10:48 UTC 2015


x-post
http://www.reddit.com/r/sysadmin/comments/340f36/trying_to_setup_squid_as_a_
reverse_proxy_works/

At this point, I've trimmed my Squid config down to:

http_access allow all
cache_peer 127.0.0.1 parent 8084 0 no-digest no-query originserver
name=mywebsite
cache_peer_domain mywebsite beta.mywebsite.com
coredump_dir /var/cache/squid
dns_nameservers 8.8.8.8 208.67.222.222

As for my server configuration, I'm on Windows Server 2008 R2 running Squid
3.5 from http://squid.diladele.com/ Squid is a reverse proxy for a PHP
process running the PHP built-in webserver on port 8084. The issue does not
happen when the PHP webserver is on port 80, so I'm 99% sure the problem
isn't coming from there.

It's a wordpress install I'm having the problem in. When logging in at
/wp-login.php, it loads the login form, but then gives me:

ERROR
The requested URL could not be retrieved The following error was encountered
while trying to retrieve the
URL: http://beta.mywebsite.com/wp-login.php[2]
Access Denied.
Access control configuration prevents your request from being allowed at
this time. Please contact your service provider if you feel this is
incorrect.
Your cache administrator is webmaster.
Generated Mon, 27 Apr 2015 08:05:24 GMT by SERVER
(squid/3.5.1-20150206-r13746)

In the access log I get:

1430122290.530 1 192.168.10.1 TCP_MISS/403 5050
POST http://beta.mywebsite.com/wp-login.php[3] - HIER_NONE/- text/html
1430122290.532 17 69.146.194.21 TCP_MISS/403 5119
POST http://beta.mywebsite.com/wp-login.php[4] - HIER_DIRECT/12.34.56.78
text/html

And in the cache log:

2015/04/27 02:11:30 kid1| WARNING: Forwarding loop detected for:
POST /wp-login.php HTTP/1.1
Host: beta.mywebsite.com
Content-Length: 126
Pragma: no-cache
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Origin: http://beta.mywebsite.com[5]
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/41.0.2272.118 Safari/537.36
Content-Type: application/x-www-form-urlencoded
DNT: 1
Referer: http://beta.mywebsite.com/wp-login.php?loggedout=true[6]
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
Cookie:
Via: 1.1 SERVER (squid/3.5.1-20150206-r13746)
Surrogate-Capability: SERVER="Surrogate/1.0 ESI/1.0"
X-Forwarded-For: 12.34.56.78
Cache-Control: no-cache
Connection: keep-alive

Same thing happens on wp-cron.php. Near as I can tell, it's deciding a
perfectly good redirect is a forwarding redirect.

Am I missing something here? It's driving me crazy.

I should mention that viewing PHP files and HTML files and pictures all work
fine, it's just self-referential HTTP POST's that fail.





More information about the squid-users mailing list