Skip to content

Self-hosted GitLab OAuth callback ignores Internal URL and attempts HTTPS (443) causing ECONNREFUSED #3848

@isboyjc

Description

@isboyjc

To Reproduce

  1. Deploy self-hosted GitLab using Docker.

    • GitLab listens internally on port 80 only.
    • HTTPS is terminated externally via Traefik.
    • external_url is set to https://gitlab.sentenceend.com
    • nginx['listen_https'] = false
    • nginx['listen_port'] = 80
  2. Ensure GitLab and Dokploy are on the same Docker network.

  3. In Dokploy Git Provider settings:

  4. Authorize GitLab OAuth successfully.

  5. During OAuth callback, Dokploy fails with ECONNREFUSED on port 443.

Current vs. Expected behavior

Current Behavior

During OAuth callback (code → token exchange), Dokploy attempts to connect to:

10.0.1.101:443

Resulting in:

TypeError: fetch failed
[cause]: Error: connect ECONNREFUSED 10.0.1.101:443

Internal connectivity verification shows:

curl http://gitlab/api/v4/version

works (returns 401 as expected).

However:

curl http://gitlab/oauth/token

returns:

HTTP/1.1 302 Found
Location: https://gitlab/users/sign_in

GitLab redirects GET /oauth/token to HTTPS login page.

But:

curl -X POST http://localhost/oauth/token

returns:

HTTP/1.1 400 Bad Request
Missing required parameter: grant_type

This confirms that POST /oauth/token works correctly over HTTP and does NOT require HTTPS.

Despite this, Dokploy callback still attempts to connect via HTTPS (443).

Expected Behavior

When Internal URL is set to:

http://gitlab

Dokploy should:

Use the internal HTTP endpoint for OAuth token exchange

Send POST /oauth/token to port 80

Not attempt to connect to port 443

Not follow redirect to HTTPS

Provide environment information

Operating System:
OS: Ubuntu 22.04
Arch: amd64

Dokploy version: v0.28.2
GitLab version: 18.7.3-ce.0

VPS Provider: Racknerd

Docker Network Driver:
(Insert result of: docker network inspect dokploy-network --format '{{.Driver}}')

Deployment type:
Single server, Docker-based, same server where Dokploy is installed.

GitLab configuration:
- external_url 'https://gitlab.sentenceend.com'
- nginx['listen_port'] = 80
- nginx['listen_https'] = false
- nginx['redirect_http_to_https'] = false

Which area(s) are affected? (Select all that apply)

Application

Are you deploying the applications where Dokploy is installed or on a remote server?

Same server where Dokploy is installed

Additional context

Dokploy container can successfully access:

http://gitlab/api/v4/version

But cannot access:

https://gitlab.sentenceend.com (internal overlay network 443 blocked)

The failure only occurs during OAuth callback token exchange.

It appears that Internal URL is not respected during callback, and Dokploy attempts to use HTTPS instead.

Will you send a PR to fix it?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions