Welcome! Log In Create A New Profile

Advanced

Re: exclude error_page on geoip

November 04, 2016 06:36AM
Thank you very much. It is working :)

On Thu, Nov 3, 2016 at 9:18 PM, Maxim Dounin <mdounin@mdounin.ru> wrote:

> Hello!
>
> On Thu, Nov 03, 2016 at 02:05:55PM +0800, Tseveendorj Ochirlantuu wrote:
>
> > Hello,
> >
> > I need to use geoip module for allow specific region access to my
> website.
> > But blocked users should see the error_page. Users are blocked and cannot
> > see custom error_page.
> >
> > I don't want to see error_page from other domain. I need to except only
> > error page which is not applied to geoip block.
>
> Try something like this:
>
> server {
> listen 80;
>
> error_page 403 /403.html;
>
> location / {
> if ($blocked) {
> return 403;
> }
>
> ...
> }
>
> location = /403.html {
> # no geoip restrictions here
> }
> }
>
> With such a configuration GeoIP-based restrictions are only
> applied in "location /", but doesn't affect requests to /403.html.
> That is, nginx will be able to return the error page correctly.
>
> --
> Maxim Dounin
> http://nginx.org/
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

exclude error_page on geoip

Eberx November 03, 2016 02:16AM

Re: exclude error_page on geoip

Maxim Dounin November 03, 2016 09:20AM

Re: exclude error_page on geoip

Eberx November 04, 2016 06:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 152
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