Skip to content
\n

I can't figure out if it's something I've done somehow, but I don't think I touched anything.
\nFor context, I'm sitting behind a VPN and the target instance is served through HTTPS with an NGINX reverse proxy in the middle

","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"

I found out the root cause by printing the server responses from within the urllib library:

\n
UserWarning: The base URL in the server response differs from the user-provided base URL (https://gitlab.example.com:443 -> https://gitlab.example.com:80)\n
\n

So it was a configuration issue, I had this in my compose.yaml:

\n
services:\n  gitlab:\n    image: gitlab/gitlab-ee:18.0.1-ee.0\n    container_name: gitlab\n    restart: always\n    hostname: '$HOSTNAME'\n    environment:\n      GITLAB_OMNIBUS_CONFIG: |\n        # Add any other gitlab.rb configuration here, each on its own line\n        # I'm including only relevant configs here\n        external_url 'http://$HOSTNAME'\n    ports:\n      - '$SSH_PORT:22'\n    volumes:\n      - '$GITLAB_HOME/config:/etc/gitlab'\n      - '$GITLAB_HOME/logs:/var/log/gitlab'\n      - '$GITLAB_HOME/data:/var/opt/gitlab'\n    shm_size: '256m'\n\nnetworks:\n  default:\n    external: true\n    name: $NETWORK_NAME\n\n
\n

I had the external URL as HTTP, consequently GitLab assumed port 80 and that's what it would respond with when asking for paginated endpoints (gitlab.example.com:80/api<...>) since it specifies the port there, of course that couldn't work when there's Nginx Proxy Manager in the middle configured for HTTPS, so I was missing a couple lines of configuration in the gitlab.rb (through GITLAB_OMNIBUS_CONFIG) found from this post https://serverfault.com/questions/1022717/using-gitlab-docker-behind-nginx-proxy-manager-docker

\n

I put this in the variable, note the difference in external_url in particular with the added \"s\" to \"http\":

\n
GITLAB_OMNIBUS_CONFIG: |\n        # Add any other gitlab.rb configuration here, each on its own line\n        # I'm including only relevant configs here\n        external_url 'https://$HOSTNAME'\n        nginx['listen_port'] = 80\n        nginx['listen_https'] = false
\n

And now it's all working correctly, GitLab responds with HTTPS endpoints.

\n

Note: the reason why it worked until it didn't is that my requests initially didn't need pagination until I had added enough labels to the project, so it only used the URL I would provide, which also led me to believe there weren't problems with my input (which is true, the issue lies in the server response) when I tried to perform a manual connection as suggested by @JohnVillalovos to troubleshoot

","upvoteCount":1,"url":"https://github.com/python-gitlab/python-gitlab/discussions/3212#discussioncomment-13429879"}}}
Discussion options

You must be logged in to vote

I found out the root cause by printing the server responses from within the urllib library:

UserWarning: The base URL in the server response differs from the user-provided base URL (https://gitlab.example.com:443 -> https://gitlab.example.com:80)

So it was a configuration issue, I had this in my compose.yaml:

services:
  gitlab:
    image: gitlab/gitlab-ee:18.0.1-ee.0
    container_name: gitlab
    restart: always
    hostname: '$HOSTNAME'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        # Add any other gitlab.rb configuration here, each on its own line
        # I'm including only relevant configs here
        external_url 'http://$HOSTNAME'
    ports:
      - '$SSH_PORT:22'
    …

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@quazar-omega
Comment options

Comment options

You must be logged in to vote
3 replies
@nejch
Comment options

@quazar-omega
Comment options

@nejch
Comment options

Answer selected by quazar-omega
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants