removed GITLAB_RELATIVE_URL_ROOT__with_trailing_slash placeholders from nginx configs

This commit is contained in:
Sameer Naik 2015-12-12 16:14:28 +05:30
parent 7a14244cd8
commit ed1228fdd0
3 changed files with 17 additions and 23 deletions

View File

@ -64,14 +64,14 @@ server {
access_log {{GITLAB_LOG_DIR}}/nginx/gitlab_access.log;
error_log {{GITLAB_LOG_DIR}}/nginx/gitlab_error.log;
location {{GITLAB_RELATIVE_URL_ROOT}} {
location {{GITLAB_RELATIVE_URL_ROOT}}/ {
## Serve static files from defined root folder.
## @gitlab is a named location for the upstream fallback, see below.
try_files $uri /index.html $uri.html @gitlab;
}
## We route uploads through GitLab to prevent XSS and enforce access control.
location {{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}uploads/ {
location {{GITLAB_RELATIVE_URL_ROOT}}/uploads/ {
## If you use HTTPS make sure you disable gzip compression
## to be safe against BREACH attack.
# gzip off;
@ -115,28 +115,28 @@ server {
proxy_pass http://gitlab;
}
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}[\w\.-]+/[\w\.-]+/gitlab-lfs/objects {
location ~ ^{{GITLAB_RELATIVE_URL_ROOT}}/[\w\.-]+/[\w\.-]+/gitlab-lfs/objects {
client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;
return 418;
}
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$ {
location ~ ^{{GITLAB_RELATIVE_URL_ROOT}}/[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$ {
client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;
return 418;
}
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}[\w\.-]+/[\w\.-]+/repository/archive {
location ~ ^{{GITLAB_RELATIVE_URL_ROOT}}/[\w\.-]+/[\w\.-]+/repository/archive {
client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;
return 418;
}
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}api/v3/projects/.*/repository/archive {
location ~ ^{{GITLAB_RELATIVE_URL_ROOT}}/api/v3/projects/.*/repository/archive {
client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;
@ -144,7 +144,7 @@ server {
}
# Build artifacts should be submitted to this location
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}[\w\.-]+/[\w\.-]+/builds/download {
location ~ ^{{GITLAB_RELATIVE_URL_ROOT}}/[\w\.-]+/[\w\.-]+/builds/download {
client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;

View File

@ -112,14 +112,14 @@ server {
access_log {{GITLAB_LOG_DIR}}/nginx/gitlab_access.log;
error_log {{GITLAB_LOG_DIR}}/nginx/gitlab_error.log;
location {{GITLAB_RELATIVE_URL_ROOT}} {
location {{GITLAB_RELATIVE_URL_ROOT}}/ {
## Serve static files from defined root folder.
## @gitlab is a named location for the upstream fallback, see below.
try_files $uri /index.html $uri.html @gitlab;
}
## We route uploads through GitLab to prevent XSS and enforce access control.
location {{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}uploads/ {
location {{GITLAB_RELATIVE_URL_ROOT}}/uploads/ {
## If you use HTTPS make sure you disable gzip compression
## to be safe against BREACH attack.
gzip off;
@ -165,28 +165,28 @@ server {
proxy_pass http://gitlab;
}
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}[\w\.-]+/[\w\.-]+/gitlab-lfs/objects {
location ~ ^{{GITLAB_RELATIVE_URL_ROOT}}/[\w\.-]+/[\w\.-]+/gitlab-lfs/objects {
client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;
return 418;
}
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$ {
location ~ ^{{GITLAB_RELATIVE_URL_ROOT}}/[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$ {
client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;
return 418;
}
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}[\w\.-]+/[\w\.-]+/repository/archive {
location ~ ^{{GITLAB_RELATIVE_URL_ROOT}}/[\w\.-]+/[\w\.-]+/repository/archive {
client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;
return 418;
}
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}api/v3/projects/.*/repository/archive {
location ~ ^{{GITLAB_RELATIVE_URL_ROOT}}/api/v3/projects/.*/repository/archive {
client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;
@ -194,7 +194,7 @@ server {
}
# Build artifacts should be submitted to this location
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}[\w\.-]+/[\w\.-]+/builds/download {
location ~ ^{{GITLAB_RELATIVE_URL_ROOT}}/[\w\.-]+/[\w\.-]+/builds/download {
client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;
@ -202,7 +202,7 @@ server {
}
# Build artifacts should be submitted to this location
location ~ {{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}ci/api/v1/builds/[0-9]+/artifacts {
location ~ {{GITLAB_RELATIVE_URL_ROOT}}/ci/api/v1/builds/[0-9]+/artifacts {
client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;

View File

@ -699,14 +699,8 @@ nginx_configure_gitlab_ssl() {
}
nginx_configure_gitlab_relative_url() {
if [[ -n ${GITLAB_RELATIVE_URL_ROOT} ]]; then
echo "Configuring nginx::gitlab::relative_url..."
sed -i "s|{{GITLAB_RELATIVE_URL_ROOT}}|${GITLAB_RELATIVE_URL_ROOT}|g" ${GITLAB_NGINX_CONFIG}
sed -i "s|{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}|${GITLAB_RELATIVE_URL_ROOT}/|g" ${GITLAB_NGINX_CONFIG}
else
sed -i "s|{{GITLAB_RELATIVE_URL_ROOT}}|/|" ${GITLAB_NGINX_CONFIG}
sed -i "s|{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}|/|g" ${GITLAB_NGINX_CONFIG}
fi
[[ -n ${GITLAB_RELATIVE_URL_ROOT} ]] && echo "Configuring nginx::gitlab::relative_url..."
sed -i "s|{{GITLAB_RELATIVE_URL_ROOT}}|${GITLAB_RELATIVE_URL_ROOT}|g" ${GITLAB_NGINX_CONFIG}
}
nginx_configure_gitlab_ipv6() {