fix: preserve HTTP protocol for self-hosted Gitea/Forgejo instances#12439
fix: preserve HTTP protocol for self-hosted Gitea/Forgejo instances#12439neubig merged 1 commit intoOpenHands:mainfrom
Conversation
4322a60 to
9c928ee
Compare
|
I can review this one! |
9c928ee to
0d1552a
Compare
|
@neubig I am open to your idea, just let me know if you have any feedback |
neubig
left a comment
There was a problem hiding this comment.
Hi @MkDev11, thanks for contributing this!
I can understand this, but I'm a little bit worried about supporting http:// silently, because http is insecure. But maybe we can make sure that the user understands the consequences and require an environment variable ALLOW_INSECURE_GIT_ACCESS, and if it is set to true we allow this connection. If it is unset or set to false, we throw an error saying something like "Attempting to connect to an insecure git repository. If you'd like to allow this nonetheless, set ALLOW_INSECURE_GIT_ACCESS=true as an environment variable"
0d1552a to
38012e5
Compare
Done! |
Fixes OpenHands#12358 - Detect protocol from host before normalizing domain in get_authenticated_git_url() - Use detected protocol (http/https) when constructing git clone URLs - Fix web_base_url in Forgejo service to preserve protocol from BASE_URL This allows self-hosted Gitea/Forgejo instances running on HTTP to work without the sandbox forcing HTTPS and causing GnuTLS handshake failures.
38012e5 to
34c1ccf
Compare
neubig
left a comment
There was a problem hiding this comment.
Thank you for the contribution!
|
can you merge it now? |
Summary of PR
This PR fixes the issue where self-hosted Gitea/Forgejo instances running on HTTP fail with a 500 Internal Server Error due to the sandbox forcing HTTPS for git clone operations.
The root cause was that
get_authenticated_git_url()inprovider.pystrips the protocol from the host and always reconstructs URLs withhttps://, regardless of the user's configuration. This causes a GnuTLS handshake failure when the target server only supports HTTP.Changes:
httporhttps) when constructing git clone URLs for all providers (GitLab, Bitbucket, GitHub, Forgejo)web_base_urlin Forgejo service to preserve the protocol fromBASE_URLDemo Screenshots/Videos
N/A - Backend fix, no UI changes.
Change Type
Checklist
Fixes
Resolves #12358
Release Notes
Self-hosted Gitea/Forgejo instances running on HTTP now work correctly. Previously, the sandbox would force HTTPS for git clone operations, causing connection failures.
Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=94194147