Archive > 15.7 Legacy Series
[SOLVED] Squid cache seems to not be used
Tikimotel:
--- Quote from: smajor on December 16, 2015, 07:48:08 pm ---I was looking for roughly the same, there is a ticket in for some expanded Squid options via the GUI. I hope the 16.1 milestone for them comes true! (I also wish I could code at all so I could help.)
https://github.com/opnsense/core/issues/417
--- End quote ---
This seems to do the trick (I'm not good at diffs :'( )
The first step is to edit the template conf-file.
Add the "OPNsense.proxy.general.cache.memory" parts after line 270 like below.
"/usr/local/opnsense/service/templates/OPNsense/Proxy/squid.conf"
--- Code: ---# Deny all other access to this proxy
http_access deny all
{% if helpers.exists('OPNsense.proxy.general.cache.memory') %}
# Set cache_mem, (default is 256 MB)
cache_mem {{OPNsense.proxy.general.cache.memory.size}} MB
{% endif %}
{% if helpers.exists('OPNsense.proxy.general.cache.local') %}
{% if OPNsense.proxy.general.cache.local.enabled == '1' %}
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs {{OPNsense.proxy.general.cache.local.directory}} {{OPNsense.proxy.general.cache.local.size}} {{OPNsense.proxy.general.cache.local.l1}} {{OPNsense.proxy.general.cache.local.l2}}
{% endif %}
{% endif %}
--- End code ---
Then edit the model XML to include the new memory section, just start it before the "<local>" section in the "<cache>".
@ around line 71
"/usr/local/opnsense/mvc/app/models/OPNsense/Proxy/Proxy.xml"
--- Code: --- <cache>
<memory>
<size type="IntegerField">
<default>256</default>
<MinimumValue>8</MinimumValue>
<ValidationMessage>Specify a positive memory cache size. (number of MB's)</ValidationMessage>
<Required>Y</Required>
</size>
</memory>
<local>
<enabled type="BooleanField">
<default>0</default>
<Required>Y</Required>
</enabled>
--- End code ---
Then create a new subtab field called "proxy-general-cache-memory" before the "proxy-general-cache-local" section and you should have a new pull down option in the proxy service menu this is done in the form XML.
(@ around line 93)
"/usr/local/opnsense/mvc/app/controllers/OPNsense/Proxy/forms/main.xml"
--- Code: --- <div class="text-info"><b>NOTE:</b> the current Squid implementation of encode and chop violates
RFC2616 by not using a 301 redirect after altering the URL.</div>]]></help>
<advanced>true</advanced>
</field>
</subtab>
<subtab id="proxy-general-cache-memory" description="Memory Cache Settings">
<field>
<id>proxy.general.cache.memory.size</id>
<label>Memory Cache size in Megabytes</label>
<type>text</type>
<help><![CDATA[Enter the storage size for the memory cache (default is 256).]]></help>
<advanced>true</advanced>
</field>
</subtab>
<subtab id="proxy-general-cache-local" description="Local Cache Settings">
--- End code ---
franco:
The cache_mem setting addition will be part of 15.7.24 tomorrow. :)
Deku2:
I don't see any hits in the logs and I don't want to enable local cache. I want it all in memory - assigned 4Gig, but don't see that anything is hitting.
Don't see any logs at all except for a repeated "Error sending to ICMPv6 packet" in Cache: https://forum.opnsense.org/index.php?topic=1254.0 Access is empty.
Navigation
[0] Message Index
[*] Previous page
Go to full version