Don't process requests containing folders

2016-09-12 Thread Grant
My site doesn't have any folders in its URL structure so I'd like to have nginx process any request which includes a folder (cheap 404) instead of sending the request to my backend (expensive 404). Currently I'm using a series of location blocks to check for a valid request. Here's the last one be

Re: Don't process requests containing folders

2016-09-12 Thread Francis Daly
On Mon, Sep 12, 2016 at 10:17:06AM -0700, Grant wrote: Hi there, > My site doesn't have any folders in its URL structure so I'd like to > have nginx process any request which includes a folder (cheap 404) > instead of sending the request to my backend (expensive 404). The location-matching rules

Re: Don't process requests containing folders

2016-09-12 Thread Grant
>> My site doesn't have any folders in its URL structure so I'd like to >> have nginx process any request which includes a folder (cheap 404) >> instead of sending the request to my backend (expensive 404). > >> Currently I'm using a series of location blocks to check for a valid >> request. Here'

Re: Don't process requests containing folders

2016-09-12 Thread Francis Daly
On Mon, Sep 12, 2016 at 01:55:35PM -0700, Grant wrote: Hi there, > > If you want to match "requests with a second slash", do just that: > > > > location ~ ^/.*/ {} > > > > (the "^" is not necessary there, but I guess-without-testing that > > it helps.) > > When you say it helps, you mean for p

Re: Don't process requests containing folders

2016-09-12 Thread Grant
>> location ~ (^/[^/]*|.html)$ {} > > Yes, that should do what you describe. I realize now that I didn't define the requirement properly. I said: "match requests with a single / or ending in .html" but what I need is: "match requests with a single / *and* ending in .html, also match /". Will th