# Proxy\_cache\_key

**URL:** <https://www.ruby-forum.com/t/proxy-cache-key/184724>\
**Category:** NGINX\
**Created:** [March 7, 2010, 12:55pm UTC](https://www.ruby-forum.com/t/proxy-cache-key/184724 "2010-03-07T12:55:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhauser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@jhauser](https://www.ruby-forum.com/u/jhauser)\
**Post date:** [March 7, 2010, 12:55pm UTC](https://www.ruby-forum.com/t/proxy-cache-key/184724/1 "2010-03-07T12:55:46Z")

</div>

Hello, I want to generate the file path of proxy cached data from the  
proxy\_cache\_key variable. Is there some pseudo-code to generate the  
same hash as nginx does internally?

Or would it be possible to make the generated cache\_key available as a  
loggable variable?

With regards,

\_\_Janko

---

<div class="post-metadata">

**Author:** ![jhauser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@jhauser](https://www.ruby-forum.com/u/jhauser)\
**Post date:** [March 25, 2010, 3:15pm UTC](https://www.ruby-forum.com/t/proxy-cache-key/184724/2 "2010-03-25T15:15:26Z")

</div>

The documentation for the proxy\_cache\_path directive of the  
NginxHttpProxyModule states that the “Key and filename in cache is md5  
of proxied URL”. Here is an example:

a user requests:  
[Foo.com](http://nginx.foo.com/bar.html)

nginx has the proxy\_pass directive:  
proxy\_pass [http://apache.foo.com/](http://apache.foo.com/)

the cached filename will be the md5 of:  
[Foo.com](http://apache.foo.com/bar.html)

This worked for me when using the default proxy\_cache\_key with nginx  
0.7.62

Posted at Nginx Forum:

> **[Re: proxy\_cache\_key](https://forum.nginx.org/read.php?2,61057,67641#msg-67641)**
>
> Hello, I want to generate the file path of proxy cached data from the proxy\_cache\_key variable. Is there some pseudo-code to generate the same hash as nginx does internally? Or would it be possible to make the generated cache\_key available as a...
