2016-08-12 284 views
0

我目前正试图通过代理来遏制网站。 我使用Squid设置代理服务器。 我的squid.conf的配置是:代理服务器上的cUrl返回状态200,cUrl通过代理返回403

acl allowed_ip src xxx.xxx.xxx.xxx (ip of the other server) 
http_access allow allowed_ip 
http_access deny all 

当我ssh我的代理服务器上,我可以这样做:

curl http://www.submarino.com.br -i 

,我也得到:

HTTP/1.1 200 OK 
Content-Type: text/html;charset=UTF-8 
Server: Apache-Coyote/1.1 
X-Powered-By: JSF/1.2 
x-tid: CATALOGO-05ada7f1-ed40-4192-b487-47e658111844 
Cache-Control: max-age=698 
Expires: Fri, 12 Aug 2016 18:48:49 GMT 
Date: Fri, 12 Aug 2016 18:37:11 GMT 
Transfer-Encoding: chunked 
Connection: keep-alive 
Connection: Transfer-Encoding 
Set-Cookie: MobileOptOut=1; path=/; domain=submarino.com.br 
Set-Cookie: b2wChannel=INTERNET; path=/; domain=submarino.com.br 
Vary: Accept-Encoding, User-Agent 

但如果我尝试卷曲通过我的其他服务器,使用:

curl 'http://www.submarino.com.br' --proxy 128.199.209.72:3128 -v 

我得到:

* Rebuilt URL to: http://www.submarino.com.br/ 
* Hostname was NOT found in DNS cache 
* Trying xxx.xxx.xxx.xx... 
* Connected to xxx.xxx.xxx.xx (xxx.xxx.xxx.xx) port xxxx (#0) 
> GET http://www.submarino.com.br/ HTTP/1.1 
> User-Agent: curl/7.35.0 
> Host: www.submarino.com.br 
> Accept: */* 
> Proxy-Connection: Keep-Alive 
> 
< HTTP/1.1 403 Forbidden 
* Server AkamaiGHost is not blacklisted 
< Server: AkamaiGHost 
< Mime-Version: 1.0 
< Content-Type: text/html 
< Content-Length: 274 
< Expires: Fri, 12 Aug 2016 18:31:16 GMT 
< Date: Fri, 12 Aug 2016 18:31:16 GMT 
< Set-Cookie: MobileOptOut=1; path=/; domain=submarino.com.br 
< Set-Cookie: b2wChannel=INTERNET; path=/; domain=submarino.com.br 
< Vary: Accept-Encoding, User-Agent 
< X-Cache: MISS from ubuntu-512mb-sgp1-01 
< X-Cache-Lookup: MISS from ubuntu-512mb-sgp1-01:3128 
< Via: 1.1 ubuntu-512mb-sgp1-01 (squid/3.5.12) 
< Connection: keep-alive 
< 
* Connection #0 to host ----------- left intact 

从结果看来,我通过代理连接。没有代理时卷曲时,我会得到相同的结果。任何人都可以请解释一下这个?

UPDATE:

我设置基本身份验证我的代理,但错误是一样的。我可以连接到代理服务器,但在给定的URL(www.submarino.com.br)上curl失败。 其他网址工作正常。

我试图通过我的本地主机上的相同代理卷曲。

GET http://www.submarino.com.br/ HTTP/1.1 
> Host: www.submarino.com.br 
> Proxy-Authorization: Basic cHJvbW9jb246cHJvbW9jb25ieWdlbmV6emkyMDE2 
> User-Agent: curl/7.47.0 
> Accept: */* 
> Proxy-Connection: Keep-Alive 
> 
< HTTP/1.1 200 OK 

而我的服务器上

Proxy auth using Basic with user 'xxxxxx' 
> GET http://www.submarino.com.br/ HTTP/1.1 
> Proxy-Authorization: Basic cHJvbW9jb246cHJvbW9jb25ieWdlbmV6emkyMDE2 
> User-Agent: curl/7.35.0 
> Host: www.submarino.com.br 
> Accept: */* 
> Proxy-Connection: Keep-Alive 
> 
< HTTP/1.1 403 Forbidden 

基本上他们的时候我也不代理卷曲请求工作一样。

回答

0

你的鱿鱼代理主机拒绝请求。您可能需要使用代理进行身份验证。

+0

实际上,如果直接在我的普通服务器上卷曲到该网址,则会得到此响应。我说“连接到xxx.xxx.xxx.xx(xxx.xxx.xxx.xx)端口xxxx(#0)”。我只是为了隐私目的而将这个IP地址xxx。 – pcezar91