Disable serve static files

Somehow i want to disable public access to assets. In development by config.serve_static_files = false, it serves the purpose. It routes requests to upload controller, where i can authenticate or deny access. While in production it doesn’t seem to be working. In my app.yml file

DISCOURSE_SERVE_STATIC_ASSETS: false

On production assets are served by nginx:

    location ~ ^/assets/(?<asset_path>.+)$ {
      expires 1y;
      brotli_static on;
      gzip_static on;
      add_header Cache-Control public,immutable;
    }

2 Likes

Ahan, Can I somehow change ngnix configuration from outside container? may be in app.yml?

Yes, you’ll need to write a custom pups config statement to remove the config from the nginx config file.

1 Like