Skip to content

docker: ignore proxy for healthcheck command#7532

Merged
unknwon merged 2 commits intogogs:mainfrom
MatthiasJobst:proxy
Jan 31, 2026
Merged

docker: ignore proxy for healthcheck command#7532
unknwon merged 2 commits intogogs:mainfrom
MatthiasJobst:proxy

Conversation

@MatthiasJobst
Copy link
Contributor

@MatthiasJobst MatthiasJobst commented Aug 16, 2023

Add --noproxy for localhost to prevent from using a proxy for this request

Describe the pull request

This PR fixes #7529.

When the environment variables HTTP_PROXY and/or HTTPS_PROXY are set, the routing even for localhost goes through the proxy. In cases where the docker image uses a port redirection this request fails.
When accessing itself as a host a proxy is not really needed so this is disabled in the HEALTHCHECK.

Link to the issue: #7529

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code or have provided the test plan.

Test plan

This fix can be verified by starting a docker container with the following additional parameters: -e HTTP_PROXY=host.docker.internal -e HTTPS_PROXY=host.docker.internal. When this fix is not present a docker inspect or a docker ps will show the container as unhealthy. With this fix the container is healthy.

A command for verification could look like this:

docker run -d -e HTTP_PROXY=host.docker.internal -e HTTPS_PROXY=host.docker.internal --name gogs_test gogs/gogs:latest

docker ps gogs_test

Add --noproxy for localhost to prevent from using a proxy for this request
Copy link
Member

@unknwon unknwon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@unknwon unknwon changed the title Update Dockerfile to fix #7529 docker: ignore proxy for healthcheck command Jan 31, 2026
@unknwon unknwon merged commit 9963268 into gogs:main Jan 31, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker health check is not working when using a proxy

2 participants