[squid-users] Configuring squid to fake Internet connection
squid3 at treenet.co.nz
Fri Sep 11 23:28:25 UTC 2020
On 11/09/20 4:07 am, Ari Fordsham wrote:
> Hi, I'm brand new to Squid.
> I am trying to use Squid to solve the following problem -
> I work on the road, often without an Internet connection. Unfortunately,
> an application I am using downloads some files from the Internet on
> every interface navigation, and when offline, waits (2 minutes!) for the
> connection to time out before responding. This makes the
> application completely unusable. The actual content of the download is
> unimportant (probably even a 404 error would be fine) but I cannot
> prevent the application from waiting for connection timeout.
Have you disabled ICMP on this network?
ICMP is used by routers to inform other devices about network
connectivity being offline etc. When ICMP is working the software would
not be able to have a hung connection waiting for timeout - it would be
terminated immediately upon the routers command.
This is important to fix because if you have disabled ICMP then Squid
will have the same timeout issues that software is having. Things might
even get *worse* because Squid tries multiple times to fetch content
before giving up and has even longer timeouts.
> To this end I installed squid, and have successfully routed the traffic
> from said problematic application through it, to the exclusion of
> regular Internet, including browsing traffic, which does not go through
> squid, and successfully configured internet access through squid.
I assume that means you have any environment, interception or
application proxy settings already configured and working.
> I would now like to configure squid so that i can run the application
> (with internet on), loading its downloads into squid's cache, and then
> have squid serve that up to the application instantly on every
> subsequent request, irrelevant of internet connectivity and content
> expiry headers,
Those headers exist in the traffic for very good reasons. The nature of
web applications is that the content is *generated* on demand based on
dynamic state from the client. There is no way for Squid to know the
internal code and design of any application in order to generate those
responses or even request them ahead of time.
You said the content of the download is fine. So errors generated by
Squid saying it could not get connectivity should be fine instead of
trying to cache everything.
> including from a fresh boot while offline.
> Can someone point me toward the correct configuration/directives?
Squid by default caches everything which is cacheable. No settings to do
for that part of things. If the traffic is http:// then there is nothing
else to configure.
If the traffic is HTTPS and the client software opening CONNECT tunnels
to use the proxy, then you will need SSL-Bump feature configured to
decrypt the traffic before caching can be done. Details on that can be
found in the wiki <https://wiki.squid-cache.org/Features/SslPeekAndSplice>
More information about the squid-users