Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
ec7a14f1
Commit
ec7a14f1
authored
Oct 18, 2017
by
Fred Smith
Committed by
GitHub
Oct 18, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4148 from edx/derf/set_no-cache_on_404s_on_static_files
set no-cache on 404s on static files
parents
e391baab
3cb92a0f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
7 deletions
+23
-7
playbooks/roles/nginx/tasks/main.yml
+6
-2
playbooks/roles/nginx/templates/edx/app/nginx/sites-available/maps.j2
+12
-0
playbooks/roles/nginx/templates/edx/app/nginx/sites-available/static-files.j2
+5
-5
No files found.
playbooks/roles/nginx/tasks/main.yml
View file @
ec7a14f1
...
...
@@ -111,6 +111,7 @@
with_items
:
-
{
src
:
'
etc/nginx/nginx.conf.j2'
,
dest
:
'
/etc/nginx/nginx.conf'
,
group
:
'
{{
common_web_user
}}'
,
mode
:
"
0644"
}
-
{
src
:
'
edx/app/nginx/sites-available/edx-release.j2'
,
dest
:
'
{{
nginx_sites_available_dir
}}/edx-release'
,
group
:
'
root'
,
mode
:
"
0600"
}
-
{
src
:
'
edx/app/nginx/sites-available/maps.j2'
,
dest
:
'
{{
nginx_sites_available_dir
}}/maps'
,
group
:
'
root'
,
mode
:
"
0600"
}
notify
:
restart nginx
tags
:
-
install
...
...
@@ -131,12 +132,15 @@
-
name
:
Creating link for common nginx configuration
file
:
src
:
"
{{
nginx_sites_available_dir
}}/
edx-release
"
dest
:
"
{{
nginx_sites_enabled_dir
}}/
edx-release
"
src
:
"
{{
nginx_sites_available_dir
}}/
{{
item
}}
"
dest
:
"
{{
nginx_sites_enabled_dir
}}/
{{
item
}}
"
state
:
link
owner
:
root
group
:
root
notify
:
reload nginx
with_items
:
-
"
edx-release"
-
"
maps"
tags
:
-
install
-
install:configuration
...
...
playbooks/roles/nginx/templates/edx/app/nginx/sites-available/maps.j2
0 → 100644
View file @
ec7a14f1
# nginx maps are defined at the top level and are global
# cache header for static files
map $status $cache_header_long_lived {
default "max-age=315360000";
404 "no-cache";
}
map $status $cache_header_short_lived {
default "max-age=300";
404 "no-cache";
}
playbooks/roles/nginx/templates/edx/app/nginx/sites-available/static-files.j2
View file @
ec7a14f1
...
...
@@ -16,14 +16,14 @@
# http://www.red-team-design.com/firefox-doesnt-allow-cross-domain-fonts-by-default
location ~ "/static/(?P<collected>.*\.[0-9a-f]{12}\.(eot|otf|ttf|woff|woff2)$)" {
expires max
;
add_header "Cache-Control" $cache_header_long_lived always
;
add_header Access-Control-Allow-Origin *;
try_files /staticfiles/$collected /course_static/$collected =404;
}
# Set django-pipelined files to maximum cache time
location ~ "/static/(?P<collected>.*\.[0-9a-f]{12}\..*)" {
expires max
;
add_header "Cache-Control" $cache_header_long_lived always
;
# Without this try_files, files that have been run through
# django-pipeline return 404s
try_files /staticfiles/$collected /course_static/$collected =404;
...
...
@@ -31,7 +31,7 @@
# Set django-pipelined files for studio to maximum cache time
location ~ "/static/(?P<collected>[0-9a-f]{7}/.*)" {
expires max
;
add_header "Cache-Control" $cache_header_long_lived always
;
# Without this try_files, files that have been run through
# django-pipeline return 404s
...
...
@@ -40,8 +40,8 @@
{% include "static-files-extra.j2" ignore missing %}
#
Expire other static files immediately
(there should be very few / none of these)
expires 300
;
#
Non-hashed files
(there should be very few / none of these)
add_header "Cache-Control" $cache_header_short_lived always
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment