Disable serve static files


(Leo) #1

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


(Rafael dos Santos Silva) #2

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;
    }


(Leo) #3

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


(Matt Palmer) #4

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