Merge branch '27936-disable-nginx-cache-for-uploads' into 'master'

Disable Nginx cache for everything but /assets/

See merge request !1314
This commit is contained in:
Marin Jankovski 2017-03-03 16:35:19 +00:00
commit 6c1cdd8c3e
1 changed files with 27 additions and 20 deletions

View File

@ -113,29 +113,36 @@ server {
access_log <%= @log_directory %>/gitlab_access.log gitlab_access;
error_log <%= @log_directory %>/gitlab_error.log;
## If you use HTTPS make sure you disable gzip compression
## to be safe against BREACH attack.
<%= 'gzip off;' if @https %>
## https://github.com/gitlabhq/gitlabhq/issues/694
## Some requests take more than 30 seconds.
proxy_read_timeout <%= @proxy_read_timeout %>;
proxy_connect_timeout <%= @proxy_connect_timeout %>;
proxy_redirect off;
<% if @custom_error_pages %>
proxy_intercept_errors on;
<% end %>
proxy_http_version 1.1;
<% @proxy_set_headers.each do |header| %>
<% next if header[1].nil? %>
proxy_set_header <%= header[0] %> <%= header[1] %>;
<% end %>
<% path = @relative_url ? @relative_url : "/" %>
location <%= path %> {
## If you use HTTPS make sure you disable gzip compression
## to be safe against BREACH attack.
<%= 'gzip off;' if @https %>
## https://github.com/gitlabhq/gitlabhq/issues/694
## Some requests take more than 30 seconds.
proxy_read_timeout <%= @proxy_read_timeout %>;
proxy_connect_timeout <%= @proxy_connect_timeout %>;
proxy_redirect off;
<% if @custom_error_pages %>
proxy_intercept_errors on;
<% end %>
proxy_http_version 1.1;
<% @proxy_set_headers.each do |header| %>
<% next if header[1].nil? %>
proxy_set_header <%= header[0] %> <%= header[1] %>;
<% end %>
proxy_pass http://gitlab-workhorse;
proxy_cache off;
proxy_pass http://gitlab-workhorse;
}
location <%= File.join(path, 'assets') %> {
proxy_cache <%= @proxy_cache %>;
proxy_pass http://gitlab-workhorse;
}
<% errors = Nginx.parse_error_pages %>
<% errors.each do |err, location| %>
error_page <%= err %> /<%= location %>;