0
votes

I am trying to set up a proxy server on Amazon EC2 (Singapore). But I always get "302 moved temporarily" error while trying to run "Squidclient http://www.google.com" on EC2 instance. And I cannot reach any site with that proxy as well from local desktop. I am just new to Squid. May anyone help me find out what is wrong?

My EC2 instance is a t2.micro Ubuntu Server 14.04 LTS one. I created a test security group with all traffics inbound/outbound enabled from/to anywhere. The squid version is 3.3.8.

The squid.conf is as below actually the default one, but commented out all deny lines and allow all http_access.

acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT
#http_access deny !Safe_ports
#http_access deny CONNECT !SSL_ports
#http_access allow localhost manager
#http_access deny manager
#http_access allow localhost
http_access allow all
http_port 3128
cache_dir ufs /var/spool/squid3 100 16 256
coredump_dir /var/spool/squid3
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern (Release|Packages(.gz)*)$      0       20%     2880
refresh_pattern .               0       20%     4320

The error from "Squidclient http://www.google.com" is:

HTTP/1.1 302 Moved Temporarily
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Location: http://www.google.com.sg/?gfe_rd=cr&ei=AM2WVORc0YagA8zFgoAI
Content-Length: 260
Date: Sun, 21 Dec 2014 13:37:04 GMT
Server: GFE/2.0
Alternate-Protocol: 80:quic,p=0.02
X-Cache: MISS from ip-172-31-15-144
X-Cache-Lookup: MISS from ip-172-31-15-144:3128
Via: 1.1 ip-172-31-15-144 (squid/3.3.8)
Connection: close

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.com.sg/?gfe_rd=cr&amp;ei=AM2WVORc0YagA8zFgoAI">here</A>.
</BODY></HTML>
1
no one can help......?shinji

1 Answers

0
votes

The Squidclient running result looks reasonable to me. Your ec2 instance located in Singapore, and google is redirecting you to www.google.com.sg

Note the output from Squidclient

<A HREF="http://www.google.com.sg

The reason you can't reach out to any site via the squid proxy from you local desktop, is that you have to explicitly allow your desktop's public IP in squid's config, like below

acl home_network src <your desktop public IP>
http_access allow home_network

Then restart squid

Finally, try to config squid to listen on a higher port number instead of 3128, more detail is at How can I using squid from internet