Nginx: allow access to admin ONLY if the request has a secret header. Do this without the if-evil case.

Quintin Par quintinpar at gmail.com
Tue May 29 05:13:27 UTC 2018


Thank you for validating. I was not sure if the “if” here was a good use.


- Quintin

On Mon, May 28, 2018 at 9:28 AM, Aleksandar Lazic <al-nginx at none.at> wrote:

> On 28/05/2018 07:16, Quintin Par wrote:
>
>> My website’s being hit hard and I am trying to see if I can limit this at
>> the load balancer (Nginx) level by cutting off requests that don’t have a
>> special header.
>>
>> I’ve seen some solutions that involve the if statement, notably
>>
>> https://stackoverflow.com/questions/18970620/nginx-reject-re
>> quest-if-header-is-not-present-or-wrong
>> <https://mailtrack.io/trace/link/ff187b241fb110ea6410647c76dcff0ede27409b?url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F18970620%2Fnginx-reject-request-if-header-is-not-present-or-wrong&userId=74734&signature=3d46a17240b8dccb>
>>
>>
>> Can someone help me with a solution that does NOT involve using an if
>> statement?
>>
>
> What's wrong with if in your use case.
>
> The solution with the map looks okay to me.
>
> - Quintin
>>
>
> Best regards
> aleks
>
> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>> <https://mailtrack.io/trace/link/7ebb0fa17bf49ee0752d217598865e9246529106?url=http%3A%2F%2Fmailman.nginx.org%2Fmailman%2Flistinfo%2Fnginx&userId=74734&signature=dbe9405384fc1bee>
>>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
> <https://mailtrack.io/trace/link/7ebb0fa17bf49ee0752d217598865e9246529106?url=http%3A%2F%2Fmailman.nginx.org%2Fmailman%2Flistinfo%2Fnginx&userId=74734&signature=dbe9405384fc1bee>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20180528/343b2d77/attachment.html>


More information about the nginx mailing list