Commit bc793808 authored by Alain Takoudjou's avatar Alain Takoudjou

gitlab: Ajax will send OPTIONS request which is not implemented in gitlab, ngix can reply

When getting a raw file in gitlab with ajax a first OPTIONS request is send, this simply fail because not implemented. To solve the problem, we allow nginx to reply to OPTIONS request and allow GET method.

/reviewed-on !663
parent 55c5a344
Pipeline #6996 failed with stage
in 0 seconds
......@@ -66,7 +66,7 @@ md5sum = a56a44e96f65f5ed20211bb6a54279f4
[nginx-gitlab-http.conf.in]
_update_hash_filename_ = template/nginx-gitlab-http.conf.in
md5sum = abcc5eda03e10b26c74619f299a7f6a8
md5sum = e74695aa1be60f0ffac64ddbe1c8eaf1
[nginx.conf.in]
_update_hash_filename_ = template/nginx.conf.in
......
......@@ -121,6 +121,13 @@ server {
# Set CORS header
add_header 'Access-Control-Allow-Origin' {{ cfg('nginx_header_allow_origin') }};
add_header 'Access-Control-Allow-Credentials' true;
if ($request_method = OPTIONS ) {
add_header Allow "GET, OPTIONS";
add_header Content-Type text/plain;
add_header 'Access-Control-Allow-Origin' $http_origin;
add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Authorization, Content-Type, Accept";
return 200;
}
## If you use HTTPS make sure you disable gzip compression
## to be safe against BREACH attack.
{{ 'gzip off;' if cfg_https else ''}}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment