FreeBSD: HTTP 422 behind reverse proxy

I’ve installed the latest GitLab version in a FreeBSD jail. PostgreSQL is used as database server in its own jail and external connections are passed to GitLab through a nginx reverse proxy, which is separated in its own jail as well. When accessing my GitLab instance I get a 422 and see the following output in my browser console:

Mixed Content: The page at 'https://mydomain.com/users/sign_in' was loaded over HTTPS, but requested an insecure favicon 'http://mydomain.com:443/assets/favicon-7901bd695fb93edb07975966062049829afb56cf11511236e61bcf425070e36e.png'. This request has been blocked; the content must be served over HTTPS.

I found this (similar) issue (I do not use Docker):

In my /usr/local/www/gitlab-ce/config/gitlab.yml I’ve the following configuration:

gitlab:
    host: mydomain.com
    port: 443
    https: true
trusted_proxies:
      - 192.168.178.0/24

However, I don’t know how to apply these settings under FreeBSD. Where to add this configuration under FreeBSD?

external_url 'https://mydomain.com'
nginx['listen_port'] = 80
nginx['listen_https'] = false

Does anybody know which configuration I must apply in order to get this running? Which configuration for my reverse proxy, for my local Nginx, for the GitLab instance itself?

Setup:
FreeBSD 12.1-RELEASE-p7
GitLab 13.1.4
PostgreSQL 12.3
Nginx 1.18.0 (reverse and local HTTPd)

Alright, I’ve found the problem and solved it.

For anyone else running into this issue - the above setting is correct.
In order to get it running delete your browser cookies and then add these lines in your reverse proxy configuration (Nginx):
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Ssl on;

1 Like

Hi @joh-ku! Welcome to our community forum!

I am so glad to hear you were able to solve this! Let me know if you need anything else! :blush: