Welcome! Log In Create A New Profile

Advanced

Don't process requests containing folders

Grant
September 12, 2016 01:18PM
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 before nginx internal takes over:

location ~ (^/|.html)$ {
}

Can I expand that to only match requests with a single / or ending in
..html like this:

location ~ (^[^/]+/?[^/]+$|.html$) {
}

Should that work as expected?

- Grant

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Don't process requests containing folders

Grant September 12, 2016 01:18PM

Re: Don't process requests containing folders

Francis Daly September 12, 2016 04:28PM

Re: Don't process requests containing folders

Grant September 12, 2016 04:58PM

Re: Don't process requests containing folders

Francis Daly September 12, 2016 05:50PM

Re: Don't process requests containing folders

Grant September 12, 2016 07:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 135
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready