Blocking all the URL except 1

Zeal Vora zeal at freecharge.com
Fri Jun 24 07:31:50 UTC 2016


Thanks. The above lined helped. However one more doubt. I want NGINX to
return 200 whenever some one goes to /nature , so I wrote above
configuration, however when some one goes to /nature , NGINX gives it 404
instead of 200. Here is my configuration :-

server {
  location = /nature {
  return 200;
  }
}

server {
    listen 80;
    server_name  example.com;

    location = / {
         proxy_pass http://app:server;
    }

    location / {
         return 404;
     }
}


On Thu, Jun 23, 2016 at 10:19 PM, Edho Arief <me at myconan.net> wrote:

> Hi,
>
> On Fri, Jun 24, 2016, at 01:47, Zeal Vora wrote:
> > Hi
> >
> > We have a Nginx Box which acts as a reverse proxy to backend
> > applications.
> >
> > We only want to allow traffic on http://example.com which internally
> > redirects to specific application. Other then that, every other URI
> > should
> > be blocked.
> >
> > For example :-
> >
> > example.com            Allowed
> > example.com/test     Blocked
> > example.com/login    Blocked
> >
> > How can I achieve this ?
> >
>
>
> does this work?
>
> location = / {
>   return 302 https://...
> }
>
> location / {
>   return 404;
> }
>
> _______________________________________________
> 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/20160624/8e924197/attachment.html>


More information about the nginx mailing list