• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Issue Nginx add_header not woking inside locations

bernhardh86

Basic Pleskian
I am now trying around since hours, but I can't get in work.

On apache&nginx settings page, I have turned off proxy mode and the "static files direct" option. Then I have added this (and only this) additional config to the textarea:

```
location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|webp)$ {
access_log off;
expires 365d;
add_header 'Cache-Control' "public, max-age=365";
}
```

This should add the "Cache-Control" setting on all static media files and it is based on this: Additional nginx directives are not applied when nginx proxy mode is disabled in Plesk

But it doesn't work. Chrome doesn't show it.

Then I have tried to remove everything but the `add_header ..` line:

```
add_header 'Cache-Control' "public, max-age=365";
```

And now its working, but of course for all files, not only media files.

I have even tried this:

```
location / {
add_header 'Cache-Control' "public, max-age=365";
}
```

and it is not adding the header.


Anybody an idea, why its not working as expected.
 
Ok. It looks like my problem was, that I used the "password protected directory" function, which breaks some nginx config features. Turning it off and protecting the folders manually works without problems
 
Back
Top