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
I found out the root cause by printing the server responses from within the urllib library:
\nUserWarning: The base URL in the server response differs from the user-provided base URL (https://gitlab.example.com:443 -> https://gitlab.example.com:80)\nSo it was a configuration issue, I had this in my compose.yaml:
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\nI 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
I put this in the variable, note the difference in external_url in particular with the added \"s\" to \"http\":
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'] = falseAnd now it's all working correctly, GitLab responds with HTTPS endpoints.
\nNote: 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"}}}-
|
Hi! I can't figure out if it's something I've done somehow, but I don't think I touched anything. |
Beta Was this translation helpful? Give feedback.
-
|
I pasted this into Google Gemini The requests.exceptions.SSLError: HTTPSConnectionPool(host='gitlab.example.com', port=80): Max retries exceeded with url: ... (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1028)'))) error indicates a problem with the SSL/TLS handshake between your Python program and the GitLab server.
Correct URL for HTTPS
|
Beta Was this translation helpful? Give feedback.
-
|
I found out the root cause by printing the server responses from within the urllib library: So it was a configuration issue, I had this in my 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 ( I put this in the variable, note the difference in GITLAB_OMNIBUS_CONFIG: |
# Add any other gitlab.rb configuration here, each on its own line
# I'm including only relevant configs here
external_url 'https://$HOSTNAME'
nginx['listen_port'] = 80
nginx['listen_https'] = falseAnd now it's all working correctly, GitLab responds with HTTPS endpoints. 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 |
Beta Was this translation helpful? Give feedback.
I found out the root cause by printing the server responses from within the urllib library:
So it was a configuration issue, I had this in my
compose.yaml: