How do I show 403 error

Hi Guys,

I just setup nginx reverse proxy for my webservers which has port 80/443
opened from internet and have very restircted access on firewall to the
destination servers again those to particular servers on port 80 and
443.

What I see in the logs is
“GET http://www.baidu.com/ HTTP/1.1” 200 626 “-” “Mozilla/4.0
(compatible;
MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR
3.0.04506.648;
.NET CLR 3.5.21022)” “-”

I know people are trying to use my server as open proxy which is failing
and
even I am not able to browse the sites but I am not getting any error
page
on my browser and just see blank page that means server is accepting the
request but unable to forward.

Hence would like to know how do I throw error message in nginx so that
those
requests would not even accepted by my proxy.

Posted at Nginx Forum:

Hello!

On Tue, Mar 03, 2015 at 11:07:16PM -0500, blason wrote:

I know people are trying to use my server as open proxy which is failing and
even I am not able to browse the sites but I am not getting any error page
on my browser and just see blank page that means server is accepting the
request but unable to forward.

Hence would like to know how do I throw error message in nginx so that those
requests would not even accepted by my proxy.

Try something like this in your config:

server {
    listen 80 default_server;
    return 403;
}

See here for details:

http://nginx.org/en/docs/http/request_processing.html


Maxim D.
http://nginx.org/

Thanks Max.

I am just trying that on my test server. Also this proxy I am gonna use
for
MS Exchange OWA and thus would not want to publish /ActiveSync and
/offlineaddressbok urls through my reverse proxy.

How can I block certain urls or path in nginx so that those URLs would
not
be accessible or proxied from internet?

Posted at Nginx Forum:

Hello!

On Wed, Mar 04, 2015 at 10:16:02PM -0500, blason wrote:

Thanks Max.

I am just trying that on my test server. Also this proxy I am gonna use for
MS Exchange OWA and thus would not want to publish /ActiveSync and
/offlineaddressbok urls through my reverse proxy.

How can I block certain urls or path in nginx so that those URLs would not
be accessible or proxied from internet?

http://nginx.org/r/location

See here for even more docs:

http://nginx.org/en/docs/


Maxim D.
http://nginx.org/