Re: I need my “bad user agent” map not to block my rss xml file

Francis Daly francis at daoine.org
Thu Jan 10 08:50:33 UTC 2019


On Wed, Jan 09, 2019 at 06:14:04PM -0800, lists at lazygranch.com wrote:

Hi there,

>  location / {
>          if ($badagent)     { return 403; }
>  }
>  location = /feeds {
>          try_files $uri $uri.xml $uri/ ;
>         }

>  The "=" should force an exact match, but the badagent map is
>  checked.  
> 
> Absolutely the badagent check under location / is being triggered.
> Everything works if I comment out the check.
> 
> The URL to request the XML file is domain.com/feeds/file.xml . 

If the request is /feeds/file.xml, that will not exactly match "/feeds".

  location = /feeds/file.xml {}

should serve the file feeds/file.xml below the document root.

Or, if you want to handle all requests that start with /feeds/ in a
similar way,

  location /feeds/ {}

or

  location ^~ /feeds/ {}

should do that. (The two are different if you have regex locations in
the config.)

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list