我们提供一些JSON Web API。用户可以在我们的网页上创建API密钥,然后将该密钥用作HTTP头属性。但是,我们将允许试用时无需密钥即可访问。在这种情况下,我们应该如何设置nginx配置?
我们需要设置(1)和(2)。
sample request
curl -H 'x-api-key:xxxx' https://api.xxx.com/xxx
我们需要设置(1)和(2)。
(1) Without 'x-api-key' http header -> limit_req setting (e.g 10 request per sec)
(2) With 'x-api-key' http header -> no limitation.
更新 1
这个问题几乎相同。