Welcome! Log In Create A New Profile

Advanced

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

Posted by Quintin Par 
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-request-if-header-is-not-present-or-wrong


Can someone help me with a solution that does NOT involve using an if
statement?

- Quintin
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
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-request-if-header-is-not-present-or-wrong
>
>
>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
>[email protected]
>http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
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 <[email protected]> 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@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@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@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login