[Apache config] Fix URLs containing whitespace when GitLab used together with Apache
Turns off NoEscape flag for both RewriteRule.
When whitespaces are present in the URL, such as when viewing files with whitespaces in its name, Apache passes the URL incorrectly to GitLab, resulting in a blank page.
This fix has been adapted from https://gitlab.com/gitlab-org/gitlab-ce/issues/3163. It has been tested on a server with Ubuntu 14.04.3, Apache 2.4.7 and GitLab 8.3.2.
Merge request reports
Activity
could you please re-check after the merge of !50 (merged) and if needed redo/rebase onto current master?
Edited by username-removed-15158Thank you @Zenti and sorry it took so long to merge.
Removing the NE (No Escape ) flag from RewriteRule breaks accessing projects with the GitLab API via NAMESPACE/PROJECT_NAME. For example, now the request /api/v3/projects/foo%2Fbar/repository/branches will be forwarded to /api/v3/projects/foo%252Fbar/repository/branches -- it will percent encode the percent encode. See https://gitlab.com/gitlab-org/gitlab-recipes/commit/e44ea041dde57b5075f738046ec6316613cb790a
cc @Zenti
I'm currently adding another rule for api requests where the NE flag is set, as well as fixing error documents not displaying (see #43 (closed)). Will add a merge request soon.
Are there other URLs containing percent encoded characters other than the api?
@jacobvosmaer @ayufan do you have any idea?
@andy_schmidt can you try with the latest config?
@axil can't think of any right now.
@axil this fixes my API issue... thanks for the fast response, much appreciated! (Though I haven't tried out file uploads)
It does not work with my url. Im using apache 2.4 with the latest
gitlab-omnibus-ssl-apache24.conf
configHere is an example: https://git.example.com/User/example/tree/master/test%20folder
I can verify your problem on a second GitLab instance I have recently set up, but not in my primary GitLab instance.
I found a solution for my second GitLab instance. In your
gitlab-omnibus-ssl-apache24.conf
file, can you replace the lineRewriteCond %{REQUEST_URI} ^/api/v3/.* [OR]
with
RewriteCond %{REQUEST_URI} ^/api/v3/.*
and try again?
Please report back whether that fixes your problem. If it does, I will submit it as a MR.
Edited by username-removed-17194
mentioned in merge request !54 (merged)
Mentioned in issue #60