Re: Nginx Directory Listing - Restrict by IP Address

2018-05-18 Thread Sathish Kumar
Hi All, I got it working now by adding the below code. Hope it will be useful for who ever may need or looking for a solution. Only whitelisted IP addresses can do directory listing, other IP addresses can only download the files. nginx.conf http{ geo $geoAutoIndexWhitelist { default

Re: Nginx Directory Listing - Restrict by IP Address

2018-05-18 Thread Sathish Kumar
Hi Igor, I tried your config and getting error, can you help me. location / { alias /downloads/; root /data/files; autoindex on; if ($forbidlisting) { rewrite ^/(.*) /noindex_root/$1 last; } } location /noindex_root/ { internal; alias /downloads/; } nginx: [em

POST redirection with NGINX

2018-05-18 Thread pedrobrigatto
Hi guys, The base name of a web application has changed and now I need to implement a redirection of POST requests so that, whenever clients already using the old base path are not affected by this modification. So, let's say the old path to a web service is https://ip-address/old-name/rest/mymet

Re: Nginx Directory Listing - Restrict by IP Address

2018-05-18 Thread Igor A. Ippolitov
This works for me:     location / {     alias /downloads/;     autoindex on;     if ($forbidlisting) {     rewrite ^/(.*) /noindex_root/$1 last;     }     }     location /noindex_root/ {     internal;     alias /downloads/;     } On 18.05.2018 19:32, Sathish Ku

Re: Nginx filter client authentication

2018-05-18 Thread Francis Daly
On Fri, May 18, 2018 at 12:59:32PM +0200, Marcello Lorenzi wrote: Hi there, > we're trying to configure a client certificate authentication on a Nginx > 1.12.2 instance on our development environment, and all works fine. We > would filter the access to a specific site with some particular client

Re: Nginx Directory Listing - Restrict by IP Address

2018-05-18 Thread Francis Daly
On Fri, May 18, 2018 at 08:05:34AM +0800, Sathish Kumar wrote: Hi there, > We have a requirement to allow directory listing from few servers and > disallow from other ip addresses and all IP addresses should be able to > download all files inside the directory. "Directory listings" is presumably

Re: Nginx Directory Listing - Restrict by IP Address

2018-05-18 Thread Sathish Kumar
Hi, I am doing for location /, in that case how will have to change the below portion. location /downloads { alias /downloads/; autoindex on; if ($forbidlisting) { rewrite /downloads(.*) /noindex_downloads/$1 last; } } location /noindex_downloads/ { internal; alias

Re: Nginx Directory Listing - Restrict by IP Address

2018-05-18 Thread Igor A. Ippolitov
Sathish, I made a couple of minor mistakes. Please, try following configuration: map $remote_addr $forbidlisting {     default 1;     1.1.1.1 0; } location /downloads {     alias /downloads/;     autoindex on;     if ($forbidlisting) {     rewrite /downloads(.*) /noindex_downloads/$1 last

Re: custom log_format not inherited by server block

2018-05-18 Thread Maxim Dounin
Hello! On Thu, May 17, 2018 at 11:03:08PM +0100, Pete Cooper wrote: > I am compiling Nginx 1.14.0 from source on Ubuntu 18.04 LTS with > a view to compiling ipscrub as a dynamic module. > > My compile completes without error, my nginx.conf validates, > Nginx runs as expected, yet my server bl

Re: Nginx Directory Listing - Restrict by IP Address

2018-05-18 Thread Anoop Alias
Since this requires more logic, I think you can implement this in an application server / server-side scripting like php/python etc your application must verify the IP address and list files rather than web server On Fri, May 18, 2018 at 6:25 PM, Sathish Kumar wrote: > Hi, > > I tried this opt

Re: Nginx Directory Listing - Restrict by IP Address

2018-05-18 Thread Sathish Kumar
Hi, Tried this option it throws rewrite error and am not able to download file from non whitelisted ip addresses. ERROR: rewrite or internal redirection cycle while processing "/noindex_downloadsnoindex_downloadsnoindex_downloadsnoindex_downloadsnoindex_downloadsnoindex_downloadsnoindex_download

Re: Nginx Directory Listing - Restrict by IP Address

2018-05-18 Thread Sathish Kumar
Hi, I tried this option but it says autoindex need to be on or off and it's not accepting a variable. [emerg] invalid value "$allowed" in "autoindex" directive, it must be "on" or "off" in domain.conf On Fri, May 18, 2018, 7:18 PM Friscia, Michael wrote: > I think you need to change this a li

Re: Nginx Directory Listing - Restrict by IP Address

2018-05-18 Thread Igor A. Ippolitov
Hello, guys. I think, you can try something like this: location = /downloads/ {     root /downloads/;     allow 1.1.1.1;     autoindex on; } location /downloads/ {     root /downloads/; } This will work nicely if you don't need subdirectories. If you need those, you can use a rewrite like: map

Re: Nginx Directory Listing - Restrict by IP Address

2018-05-18 Thread Friscia, Michael
I think you need to change this a little map $remote_addr $allowed { default “off”; 1.1.1.1 “on”; 2.2.2.2 “on:; } and then in in the download location block autoindex $allowed; I use similar logic on different variables and try at all costs to avoid IF statem

Nginx filter client authentication

2018-05-18 Thread Marcello Lorenzi
Hi All, we're trying to configure a client certificate authentication on a Nginx 1.12.2 instance on our development environment, and all works fine. We would filter the access to a specific site with some particular client certificate to avoid that other certificates trusted by the same CA can acce