<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div data-marker="__QUOTED_TEXT__"><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Hy everybody,<br><br>I have a reverse-proxy setup with an upstream application that sets a header (x_tenant_id).<br><br>Based on that headers value, I want to apply a rate limit to clients.<br><br>I verified the rate limit applies* properly, when a usual request header (e.g. $http_x_tenant_id) is mapped. However the config below does not map $upstream_http_x_tenant_id** at all.<br><br>Any advice how to achieve rate limiting using such $upstream_http_ headers?<br><br>Thanks in advance,<br>Markus<br><br>* siege -c 10 -t5S -H 'x-tenant-id: 503' <someurl><br><br>**<br>upstream myupstream {<br>    server 10.10.100.0:8000;<br>}<br><br># does not work<br>map $upstream_http_x_tenant_id $limit_key {<br>  123 $binary_remote_addr;<br>  503 $binary_remote_addr;<br>  default "";<br>}</div><div><br>server {   <br>[...]<br>location / {<br>        # Rate limiting for some tenants<br>        limit_req zone=limit_key;<br>        limit_req_status 444;<br>        uwsgi_read_timeout 300s;<br>        uwsgi_send_timeout 300s;<br>        uwsgi_pass myupstream;<br>        include /etc/nginx/uwsgi_params;<br>    }<br>[...]<br>}</div></div></div></div><br></div></div></body></html>