Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

314
Views
Blocking case insensitive path (/admin) in nginx server

I have a requirement; any hits with /admin is blocked in the firewall but ppl are accessing it with upper case combinations like /Admin or /adMin or anything like this.

To block admin access for outside, its hard to make firewall rule for all the combinations, hence looking for some method in nginx to block this,

Please note we also need to block the subpaths like /admin/img/one.jpg (subpaths are case sensitive only admin is insensitive). Existing firewall rule is to block all outside access for /admin and allows only VPN access.

Kindly help if more details required I will update this ticket.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use a case insensitive regular expression, either using the ~* operator or using a series of character classes.

Any of the following should work:

location ~* ^/admin { return 403; }

if ($request_uri ~* ^/admin) { return 403; }

rewrite ^/[Aa][Dd][Mm][Ii][Nn] /goaway.html redirect;

Each of the above regular expressions match the beginning of the URI, so URIs containing subpaths will also match.

See this document for location, this document for if, and this document for rewrite.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!