Squid 问题 - 需要代理身份验证

发布于 10-14 18:57 字数 1566 浏览 7 评论 0原文

我有一个使用代理(正向代理)到网站的网络请求,比如说 www.example.com 这个网站有反向代理(Squid),因此我的所有请求都作为 MISS 返回。 有什么方法可以使用转发代理并检索数据吗?

请理解我是这个领域的新手。

阅读了一段时间后,我设置了不兑现,这就是我得到的

这是请求

Command: GET
URI: http://www.example.com
ProtocolVersion: HTTP/1.1
UserAgent:  Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Referer:  http://www.example.com
Accept:  */*
Accept-Charset:  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Encoding:  gzip,deflate
Accept-Language:  en-us,en;q=0.5
Keep-Alive:  115
X-Requested-With:  XMLHttpRequest
X-Prototype-Version:  1.7
Expires:  Sun, 19 Nov 1978 05:00:00 GMT
Host:  www.example.com
Cookie:  
  PHPSESSID: 249477191de6048739cd8690fabd6060
  UTG: A-3345389704b26912f6d5422.73487509-0a3a0a26a100a113a119a24a1a4a77a7a6a      
  addOtr: 7L4L2
  CLIENT_WIDTH: 1916
  MAIN_WIDTH: 1726

Cache-Control:  no-store,no-cache
Pragma:  no-cache
ProxyConnection:  Keep-Alive
HeaderEnd: CRLF

这是响应

ProtocolVersion: HTTP/1.0
StatusCode: 407, Proxy authentication required
Reason: Proxy Authentication Required
Server:  squid/3.0.STABLE19
Mime-Version:  1.0
Date:  Mon, 31 Jan 2011 19:04:44 GMT
ContentType:  text/html
ContentLength:  2986
X-Squid-Error:  ERR_CACHE_ACCESS_DENIED 0
ProxyAuthenticate: Basic realm="Anonymous proxy"
Authenticate:  Basic realm="Anonymous proxy"
X-Cache:  MISS from funky
X-Cache-Lookup:  NONE from funky:2448
Via:  1.0 funky (squid/3.0.STABLE19)
ProxyConnection:  close
HeaderEnd: CRLF 

提前致谢

I have web request that uses proxy (forward proxy) to website lets say www.example.com this web site has reverse proxy (Squid) as a result all my requests are returned as MISS.
Is there any way to use forward proxy and retrieve the data ?

Please understand that i am a newbie in this area.

After reading a while i set no cashing and this what i got

This is Request

Command: GET
URI: http://www.example.com
ProtocolVersion: HTTP/1.1
UserAgent:  Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Referer:  http://www.example.com
Accept:  */*
Accept-Charset:  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Encoding:  gzip,deflate
Accept-Language:  en-us,en;q=0.5
Keep-Alive:  115
X-Requested-With:  XMLHttpRequest
X-Prototype-Version:  1.7
Expires:  Sun, 19 Nov 1978 05:00:00 GMT
Host:  www.example.com
Cookie:  
  PHPSESSID: 249477191de6048739cd8690fabd6060
  UTG: A-3345389704b26912f6d5422.73487509-0a3a0a26a100a113a119a24a1a4a77a7a6a      
  addOtr: 7L4L2
  CLIENT_WIDTH: 1916
  MAIN_WIDTH: 1726

Cache-Control:  no-store,no-cache
Pragma:  no-cache
ProxyConnection:  Keep-Alive
HeaderEnd: CRLF

This is Response

ProtocolVersion: HTTP/1.0
StatusCode: 407, Proxy authentication required
Reason: Proxy Authentication Required
Server:  squid/3.0.STABLE19
Mime-Version:  1.0
Date:  Mon, 31 Jan 2011 19:04:44 GMT
ContentType:  text/html
ContentLength:  2986
X-Squid-Error:  ERR_CACHE_ACCESS_DENIED 0
ProxyAuthenticate: Basic realm="Anonymous proxy"
Authenticate:  Basic realm="Anonymous proxy"
X-Cache:  MISS from funky
X-Cache-Lookup:  NONE from funky:2448
Via:  1.0 funky (squid/3.0.STABLE19)
ProxyConnection:  close
HeaderEnd: CRLF 

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

没有你我更好2024-10-21 18:57:57

您需要将到期时间设置为未来。

尝试更改您的 Expires、Cache-Control 和 Pragma,使其看起来像这样:

Cache-Control:max-age=300
日期:2011 年 2 月 4 日星期五 04:52:58 GMT
到期时间:2011 年 2 月 4 日星期五 04:57:58 GMT
...

(删除 Pragma。您可以通过编辑 .htaccess 文件来完成此操作)

You need to set your expires into the future.

Try changing your Expires, Cache-Control, and Pragma to look something like this:

Cache-Control:max-age=300
Date:Fri, 04 Feb 2011 04:52:58 GMT
Expires:Fri, 04 Feb 2011 04:57:58 GMT
...

(remove Pragma. You can do this by editing you .htaccess file)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文