Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Try to set cache for static assets #252

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ http {
port_in_redirect off;
server_tokens off;

map $sent_http_content_type $expires {
default off;
application/pdf 42d;
~image/ max;
application/javascript max;
}

server {
listen {{port}};
server_name localhost;
Expand All @@ -40,13 +47,16 @@ http {
# Redirect for bulk-downloads bucket (needed this redirect here in order to access environment variable)
rewrite ^/files/bulk-downloads/(.*)$ {{env "S3_LEGAL_AND_DOWNLOADS_URL"}}/bulk-downloads/$1 redirect;

expires $expires;

location / {
resolver {{nameservers}} ipv6=off valid=1s;
set $backend "{{env "CMS_PROXY"}}";
proxy_pass $backend;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Script-Name "/";
proxy_set_header expires $expires;
}

location /regulations {
Expand Down