Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Doing a hash of IP - specifically $proxy_protocol_addr

$
0
0
This may sound like a silly request, but I'm trying to determine if there is a native way within nginx to get a hash (ideally sha1 or sha256) of the $proxy_protocol_addr into another var.

I need the hash to be in var that I can pass to the fastcgi_cache_key, I dont want to use the real IP as the key because for privacy reasons I cant store the real clear text IP.

The question is mainly about doing this natively. I can do it using an external lua or perl module, but it would great if it was built-in. I looked at the code and some hashing does occur, for example for upstream load balancing a hash of IP is done, and in the ssl module the ssl cert is hashed and stored in the var $ssl_client_cert.

My gut tells me I cant do what I want natively, unless I patch the original src code and create a new var like $proxy_protocol_hash - unfortunately my C is really rusty and that endeavor is probably out of my reach. If someone is interested in doing it though, ping me.

The compelling reason to do this native in C/recompiled src vs a lua or perl mod is performance, my use case if very high scaling

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>