Search code examples
cloud-foundryswisscomdev

Deny access to subfolders of Cloudfoundry app


Im running a Cloudfoundry app without any troubles. However, subfolders and their files are exposed and accessible simply by adding it to the URL -> for example /lang/fr.json.

Is there any way to prevent direct access to such subfolders for Cloudfundry apps? On a regular Apache server, I'd activate mod_rewrite to automatically route back to the index file of my app.

Thanks!


Solution

  • I found the solution: I'm using the standard Cloud Foundry buildpack for PHP. In the options.json file, I pass the parameter "HTTPD_VERSION":"2.4".

    With Apache 2.4 installed, I can simply place a .htaccess file in the folder I want to protect. The file only needs the content Require all denied.