exclude error_page on geoip
Tseveendorj Ochirlantuu
tseveendorj at gmail.com
Fri Nov 4 10:35:35 UTC 2016
Thank you very much. It is working :)
On Thu, Nov 3, 2016 at 9:18 PM, Maxim Dounin <mdounin at 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 at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20161104/9c5174d2/attachment.html>
More information about the nginx
mailing list