Hi Jader,
Thanks a lot, that looks like a nice solution!
I barely know how to build regex expressions, and I'm too lazy to learn just right now. Just a final question: Actually they will send me any value from 2X to 25X, but that could even increase to more than 25. I would like a simpler and more open REGEX, something like:
If it is something that includes an "X"
I will use it as this:
map $arg_capacity $my_default_key{ If it is something that includes an "X" ""; default $http_x_forwarded_for;}
Simple as that. This would catch any case, from 2X to 1000000000X. Actually it would catch even illegal values. But that is not a problem for me, cause in my java code that follows Nginx I'm validating the value they send me anyway, so I don't mind if they send me a value like "-1X" because my app would return an error status code and force them to send me a valid value anyway. The important thing is that Nginx should apply the limit if the received value is not empty, and asking if it contains an "X" covers that boolean question.