Changing sources: Memcached module variant

matamouros nginx-forum at
Wed Jun 17 19:35:43 MSD 2009

Hi everyone,

I'm having a hard time going through the sources of the memcached module, finding the thread of things. I need to do a small change in this module's behaviour, namely setting a URL in a var that will be accessible in config so that I can use that var to proxy a request for the real content. So, instead of sending a cache hit's content directly to the user, I want the memcached module to populate a URL in a variable that will be picked up by the next line in the config in order to proxy a request to it, and only then serve it's content to the user.

Right now the memcached module's current behaviour makes sense for caching html and images. In my case I need to have a map for URLs like this:

key = URL sent by client
value = masked URL for which we will get the content and proxy it

I don't really want to sound like a pussy or anything - I know my way around C - but I'm finding it hard to know where to start... The things I need are disable the response build and sending to the user after there is a cache hit, and instead populate a variable that will be accessible in config space. The proxy module should take care of things from there on. I probably need to break something in ngx_http_memcached_pass, and I have no freaking clue on how to set up a variable for config space.

Please, any help from the more experienced guys?
Thank you.

Posted at Nginx Forum:,3013,3013#msg-3013

More information about the nginx mailing list