# Does get\_url prevent caching?

**URL:** <https://forum.ansible.com/t/does-get-url-prevent-caching/20430>\
**Category:** Ansible Project\
**Created:** [February 3, 2016, 1:58am UTC](https://forum.ansible.com/t/does-get-url-prevent-caching/20430 "2016-02-03T01:58:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joshua\_J\_Kugler](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@Joshua\_J\_Kugler](https://forum.ansible.com/u/Joshua_J_Kugler)\
**Post date:** [February 3, 2016, 1:58am UTC](https://forum.ansible.com/t/does-get-url-prevent-caching/20430/1 "2016-02-03T01:58:53Z")

</div>

I am trying to download some ISOs to multiple machines (via a proxy to  
conserve bandwidth).

The ISO is being stored by the proxy, and the machine is using the proxy, but  
it is downloading from the upstream source every time. Squid is showing in its  
logs:

1454462392.008 532579 192.168.122.10 TCP\_CLIENT\_REFRESH\_MISS/200 632291702 GET  
[http://mirrors.kernel.org/centos/7.2.1511/isos/x86\_64/CentOS-7-x86\_64-Minimal-1511.iso](http://mirrors.kernel.org/centos/7.2.1511/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso) - HIER\_DIRECT/198.145.20.143 application/octet-stream

According to the squid docs:

TCP\_CLIENT\_REFRESH\_MISS  
The client issued a "no-cache" pragma, or some analogous cache control command  
along with the request. Thus, the cache has to refetch the object.

Using a standard wget (or, say, yum to retrieve packages) does not cause  
CLIENT\_REFRESH\_MISSes.

Is there something in the get\_url code that is causing the sending of a no  
cache pragma? Or maybe it's not turning off some default option in the  
underlying urllib (or whatever it uses under the hood)?

j

---

<div class="post-metadata">

**Author:** ![Andrew\_Edelstein](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Andrew\_Edelstein](https://forum.ansible.com/u/Andrew_Edelstein)\
**Post date:** [August 10, 2016, 10:37pm UTC](https://forum.ansible.com/t/does-get-url-prevent-caching/20430/2 "2016-08-10T22:37:27Z")

</div>

While I’d be interested to know the answer to this as well, why don’t you just download the ISO to a local machine, then have your Ansible play grab the ISO from that machine?

---

<div class="post-metadata">

**Author:** ![Richard\_James\_Salts](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@Richard\_James\_Salts](https://forum.ansible.com/u/Richard_James_Salts)\
**Post date:** [August 11, 2016, 3:48am UTC](https://forum.ansible.com/t/does-get-url-prevent-caching/20430/3 "2016-08-11T03:48:43Z")

</div>

> I am trying to download some ISOs to multiple machines (via a proxy to  
> conserve bandwidth).
> 
> The ISO is being stored by the proxy, and the machine is using the proxy, but  
> it is downloading from the upstream source every time. Squid is showing in its  
> logs:
> 
> 1454462392.008 532579 192.168.122.10 TCP\_CLIENT\_REFRESH\_MISS/200 632291702 GET  
> [http://mirrors.kernel.org/centos/7.2.1511/isos/x86\_64/CentOS-7-x86\_64-Minimal-1511.iso](http://mirrors.kernel.org/centos/7.2.1511/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso) - HIER\_DIRECT/198.145.20.143 application/octet-stream
> 
> According to the squid docs:
> 
> TCP\_CLIENT\_REFRESH\_MISS  
> The client issued a "no-cache" pragma, or some analogous cache control command  
> along with the request. Thus, the cache has to refetch the object.
> 
> Using a standard wget (or, say, yum to retrieve packages) does not cause  
> CLIENT\_REFRESH\_MISSes.
> 
> Is there something in the get\_url code that is causing the sending of a no  
> cache pragma? Or maybe it's not turning off some default option in the  
> underlying urllib (or whatever it uses under the hood)?

I'd say it's nothing to do with get\_url or the fact ansible is involved. It's more likely to do with the configuration of squid, particularly [http://www.squid-cache.org/Doc/config/maximum\_object\_size/](http://www.squid-cache.org/Doc/config/maximum_object_size/).  
The default is 4MB which is significantly smaller than the 600MB of the Centos ISO.
