[squid-users] Proxing only special file types
Alex Rousskov
rousskov at measurement-factory.com
Mon Feb 11 03:19:37 UTC 2019
On 2/6/19 3:48 AM, alexmaystat wrote:
> Is it possible to inspect and add JS code only to files of a specific file
> type (for example, only to JS text/javascript).
Yes, provided you can trust Content-Type response headers (or
equivalent). If you do trust them, then you can configure Squid to adapt
only responses that have Content-Type set to, say, text/javascript.
The above assumes that by "inspect" you mean inspect by an eCAP adapter.
Squid itself would still inspect (i.e., "see" and "parse") every HTTP
message it proxies, of course.
> Or it is possible to proxy only JS files, and send the rest of the content
> and requests outside squid proxy?
This is only possible (in some cases) using client-side tools like
browser PAC configuration files. If you can write a simple Javascript
program that can determine whether the pending request is for a "JS
file", and you can configure the browser to use your program (by loading
your PAC file), then you can restrict Squid traffic to those "JS file"
transactions.
As you probably know by now, modifying proxied response content is
usually difficult and often illegal. For more details, see
https://answers.launchpad.net/ecap/+faq/1793
HTH,
Alex.
More information about the squid-users
mailing list