Caddy reverse-proxying Gitlab


(Jason) #1

I’m trying to setup Gitlab on my ESXi server. I currently have it running with a default install on Ubuntu 18.04 at a LAN ip of 192.168.1.130. Gitlab currently works and is serving pages locally on http at http://192.168.1.130.

I’ve scoured the web looking for a successful setup to use Caddy to proxy a URL to https to Gitlab, but everything seems to want to run it locally (same server) or doesn’t want to pass through. With a basic caddyfile setup like this, it’s definitely not working (from the server with Caddy running, 192.168.1.20):

git.ESXISERVER.com {
  gzip
  proxy / 192.168.1.130 {
    transparent
  }
}

Any hints from people that may have been successful at doing this somehow?


(Matthew Fay) #2

Hi @ff4500, welcome to the Caddy community.

When you try your above setup, what goes wrong, exactly?


(Jason) #3

Currently not at my computer to throw the gitlab.rb file in here, but the external url in gitlab is set to http://192.168.1.130, per the Gitlab docs on it working with a reverse-proxy. It’s serving on port 80. It works just fine if you hit that URL.

In Caddy, I have the above config, but when you plug it into the url bar, it just fails. My other proxy forwards are working fine from the same file, so I know the caddyfile works.

Edit: There are no fails, no 40x or 50x messages, nothing in the log at all.


(Matthew Fay) #4

We will need a little more detail than this, I’m afraid. Without knowing where it fails, we’ll have no idea what to troubleshoot.

Does it timeout? Does Caddy respond with a 4xx or 5xx status? Do you get a certificate error? What do you see when it fails?


(Jason) #5

Yeah, sorry for being vague. I know better.

I’m not sure that the error was with Caddy at all, since I never saw any 40x or 50x headers. When I came back to it tonight, whatever I did before I left for dinner must have worked, and Gitlab started working.

For those that are curious, here’s my Caddyfile and gitlab.rb config files that are currently working:

caddyfile

git.THISISMYGITLABSERVER.xxx {
  gzip
  proxy / 192.168.1.xxx {
    transparent
  }
}

gitlab.rb (OMNIBUS install)

external_url 'http://192.168.1.xxx'
nginx['listen_port'] = 80
nginx['listen_https'] = false

It’s so simple, I’m surprised that it’s working. This is with a fresh install of Gitlab on Ubuntu 18.04 (running in a VM on ESXi) and an existing Caddy install (running in docker, on my gateway webserver, a Brix)

Thx for the moral support, and the flags for spam. Jeez.


(Matthew Fay) #6

Sorry for the inconvenience here. The system flagged you out for trying to post links to IP addresses. They just went into a queue for manual approval.

If you put them in code blocks, they don’t get flagged.

Glad to hear you’re up and running.


(Jason) #7

No problem. Just the end of a frustrating day of nothing working.
Thanks for manually approving them, and good to know for future use. My markdown is bad tonight too, I guess. Hahaha!