Skip to content

link-society/rps-middleware-gitlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RPS Middleware - Gitlab

When running Gitlab behind a reverse proxy, it can be challenging to handle its misbehaviour regarding the HTTP RFC. This project act as a middleware between your reverse proxy and the proxied Gitlab instance.

👔 Rules

Fix API Projects

The Gitlab API for projects expect the repository name (with the namespace) to be URL encoded:

/api/v4/projects/namespace%2Frepository

However, most reverse proxies will (rightfully) decode those URLs into:

/api/v4/projects/namespace/repository

Which will result in a 404 - Not Found HTTP error.

As such, this middleware will manually re-encode the last part of the URL before proxying the request to the Gitlab.

🔨 Build

Requirements:

  • Go 1.22+

Run:

$ make

📝 Usage

Run (adjust the REMOTE_URL variable):

$ export REMOTE_URL="https://gitlab.com"
$ ./rps-middleware-gitlab

Then, point your reverse proxy to <YOUR-IP>:8080.

Or run the Docker image:

$ docker run \
    -e REMOTE_URL="https://gitlab.com" \
    -p 8080:8080 \
    linksociety/rps-middleware-gitlab:latest

🚧 Docker image has not been published yet

⚖️ License

This software is distributed in the public domain, see the LICENSE.txt document for more information.