WebFaction
Community site: login faq

Is there a way to get nginx to block an IP address in "HTTP_X_FORWARDED_FOR"?

asked 12 Oct '11, 22:42

dhobbs
2825
accept rate: 100%


You can do that with the following lines in your config's main virtualhost.

if ($x_forwarded_for ~* <ip1>|<ip2>|..) {
        return 403;
 }
permanent link

answered 12 Oct '11, 23:03

neeravk
1.5k3412
accept rate: 41%

Thanks a lot!

(12 Oct '11, 23:32) dhobbs
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×186
×2
×1

question asked: 12 Oct '11, 22:42

question was seen: 5,233 times

last updated: 12 Oct '11, 23:32

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM