Web-IDE is using %2F character, causing problems with apache reverse proxy
MR: Pending
Description
As a user running a self-managed GitLab instance with a reverse proxy, I am aware of the URL path encoding constraints in the Web IDE so that I can configure my reverse proxy correctly.
Context
Currently, some of our api/v4 endpoints expect encoded slashes (%2F) in the URL. A 404 occurs when a user configured reverse proxy decodes these params into regular slashes. For example: api/v4/projects/gitlab%2Ftest is decoded to api/v4/projects/gitlab/test, which is not a valid endpoint.
Updating the reverse proxy configuration to allow for encoded slashes would solve for this. The following are reports of this issue that was solved:
Original report
Hi, I recently tried the Web-IDE noticing that it couldn't access the files inside the project, the list was empty.After a little bit of investigation (opening the Network Tab) I detected a 404 Error for the resource "/api/v4/projects/username%2Fsampleproject".
After I copied the URL into the address bar of my browser, a 404 error from Apache was displayed. I know that GitLab is using Nginx as the webserver and that I have an Apache acting as a reverse proxy. After adding the nocanon modifier to the ProxyPass everything broke with a proxy error on Apache.It is possible to get project details via the API with the numeric identifier of the project, e.g. /api/v4/projects/1234.Would it be possible to use that one instead since it is much safer with a number instead of special characters in a URL?
Acceptance Criteria
-
Update the Web IDE troubleshooting doc to highlight this path encoding constraint for customers setting up GitLab behind a reverse proxy -
In Web IDE, detect when we're not able to hit paths with %2Fand give a helpful error message with a link to the doc above. See more in technical requirements.
Technical Requirements
Modify FetchError to catch and parse URL not found errors. Here's a sample response reported by a user:
{"status":404,"body":"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL was not found on this server.</p>\n<hr>\n<address>Apache/2.4.18 (Ubuntu) Server at gitlab.testurl.com Port 443</address>\n</body></html>\n"}.
Return a message, something along the lines of:
The requested URL was not found on this server.
If you have a self-managed GitLab instance with a reverse proxy, ensure that your proxy configuration allows for encoded slashes. For more details see: \[insert link to documentation\].
UX enhancement: Display a notification with the VSCode API
