docker-squid
docker-squid copied to clipboard
not working for http & https
tried the configuration but not working for http & https
Error for http:
div id="content">
The following error was encountered while trying to retrieve the URL: http://httpbin.org/
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.
* Trying 192.168.65.2...
* TCP_NODELAY set
* Connected to host.docker.internal (192.168.65.2) port 3128 (#0)
> GET http://github.com/ HTTP/1.1
> Host: github.com
> User-Agent: curl/7.58.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 403 Forbidden
< Server: squid/3.5.27
< Mime-Version: 1.0
< Date: Mon, 17 Aug 2020 11:21:54 GMT
< Content-Type: text/html;charset=utf-8
< Content-Length: 3523
< X-Squid-Error: ERR_ACCESS_DENIED 0
< Vary: Accept-Language
< Content-Language: en
< X-Cache: MISS from 9d02f873de96
< X-Cache-Lookup: NONE from 9d02f873de96:3128
< Via: 1.1 9d02f873de96 (squid/3.5.27)
< Connection: keep-alive
<
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta type="copyright" content="Copyright (C) 1996-2017 The Squid Software Foundation and contributors">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ERROR: The requested URL could not be retrieved</title>
</head><body id=ERR_ACCESS_DENIED>
<div id="titles">
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>
<div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href="http://github.com/">http://github.com/</a></p>
<blockquote id="error">
<p><b>Access Denied.</b></p>
</blockquote>
<p>Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.</p>
<p>Your cache administrator is <a href="mailto:webmaster?subject=CacheErrorInfo%20-%20ERR_ACCESS_DENIED&body=CacheHost%3A%209d02f873de96%0D%0AErrPage%3A%20ERR_ACCESS_DENIED%0D%0AErr%3A%20%5Bnone%5D%0D%0ATimeStamp%3A%20Mon,%2017%20Aug%202020%2011%3A21%3A54%20GMT%0D%0A%0D%0AClientIP%3A%20172.17.0.1%0D%0A%0D%0AHTTP%20Request%3A%0D%0AGET%20%2F%20HTTP%2F1.1%0AUser-Agent%3A%20curl%2F7.58.0%0D%0AAccept%3A%20*%2F*%0D%0AProxy-Connection%3A%20Keep-Alive%0D%0AHost%3A%20github.com%0D%0A%0D%0A%0D%0A">webmaster</a>.</p>
<br>
</div>
<hr>
<div id="footer">
<p>Generated Mon, 17 Aug 2020 11:21:54 GMT by 9d02f873de96 (squid/3.5.27)</p>
<!-- ERR_ACCESS_DENIED -->
</div>
</body></html>
* Connection #0 to host host.docker.internal left intact```
I was hoping that someone would have a ready solution, but I'm having this problem out of the box as well.
Same here.
Same issue. Please fix!
You might need to edit your squid.conf. Out of the box, squid comes configured to deny requests other than localhost (http_access deny all).
On a fresh install, squid does this so that a) your machine doesn't proxy everything from everybody to everywhere (aka the infamous "open proxy," a vestige of yesterday's internet), basically forcing you to take charge of the extremely powerful daemon that is squid. And, b) you're forced to edit squid.conf, or supply your own, changing http_access deny all to http_access allow all.
You may have noticed that @sameersbn provides an example --volume file mapping*** for this purpose-
docker run --name squid -d --restart=always \
--publish 3128:3128 \
--volume /path/to/squid.conf:/etc/squid/squid.conf \ ***
--volume /srv/docker/squid/cache:/var/spool/squid \
sameersbn/squid:3.5.27-2
You could-
$ docker cp squid:/etc/squid/squid.conf .- Then edit your squid startup cli to
--volume ./squid.conf:/etc/squid/squid.conf, or whatever you like, e.g.-
docker run --name squid -d --restart=always \
--publish 3128:3128 \
--volume /Users/shared/projs/mycrawler/squid.conf:/etc/squid/squid.conf \ ***
--volume /srv/docker/squid/cache:/var/spool/squid \
sameersbn/squid:3.5.27-2
Think of it as a squid rite of passage, an RTFMism carried into the Docker Age.