Cracker0dks
Cracker0dks

Reputation: 2490

Nginx reverse proxy disable listing directories - autoindex

I have a reverse nginx proxy

   location / {
         autoindex off;
         proxy_set_header HOST $host;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_pass http://owncloud/;
    }

Now I want to prevent that users can go to https://url.tld/data and view the folder content... autoindex off; is not working.

I want to achieve this without changing the (owncloud) .htaccess because it's inside a docker container.

In which way is this possible?

Upvotes: 0

Views: 2145

Answers (2)

Doon
Doon

Reputation: 20232

(pulling from commment)

I don't think you are going to be able to accomplish this without chaning the own cloud configs. autoindex here isn't being used as it is just passing the request off to owncloud and owncloud is generating the content? you can block access to /data in ngnix.

Upvotes: 2

Cracker0dks
Cracker0dks

Reputation: 2490

I Solved it (thanks to @Doon) by blocking the access to the /data directory.

location /data {
     deny all;
     return 403;
}

You have to return 403 -> Forbidden (not 404) to pass the owncloud access test.

Upvotes: 1

Related Questions