when use http tool or python request,get error 'Connection refused' #4158

Closed
opened 2026-02-21 18:05:00 -05:00 by yindo · 1 comment
Owner

Originally created by @xxexplorer on GitHub (Jun 18, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.10

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I deployed dify with docker in my private environment which not access to internet.All function is ok except for HTTP tool,this is the most import tool i want to use.

✔️ Expected Behavior

the problem about the http tool and python request can be solved.
So what's wrong with the http function of dify, appreciate for answer, thanks!

Actual Behavior

when we use http tool or python request then we got the error "[Error 111] Connection refused"

Originally created by @xxexplorer on GitHub (Jun 18, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.10 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I deployed dify with docker in my private environment which not access to internet.All function is ok except for HTTP tool,this is the most import tool i want to use. ### ✔️ Expected Behavior the problem about the http tool and python request can be solved. So what's wrong with the http function of dify, appreciate for answer, thanks! ### ❌ Actual Behavior when we use http tool or python request then we got the error "[Error 111] Connection refused"
yindo added the 🐞 bug label 2026-02-21 18:05:00 -05:00
yindo closed this issue 2026-02-21 18:05:00 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 18, 2024):

To resolve the "[Error 111] Connection refused" issue with the HTTP tool and Python requests in Dify version 0.6.10, which is self-hosted using Docker in a private environment without internet access, ensure that the ssrf_proxy service is properly configured and running. Here are the steps:

  1. Ensure ssrf_proxy Service is Running:
    Make sure the ssrf_proxy service is defined and running in your docker-compose.yaml file. The relevant section should look like this:

    ssrf_proxy:
      image: ubuntu/squid:latest
      restart: always
      ports:
        - "3128:3128"
        - "8194:8194"
      volumes:
        # Please modify the squid.conf file to fit your network environment.
        - ./volumes/ssrf_proxy/squid.conf:/etc/squid/squid.conf
      networks:
        - ssrf_proxy_network
        - default
    
  2. Check squid.conf Configuration:
    Ensure that the squid.conf file is correctly configured to fit your network environment. This file should be mounted to the container as shown in the volumes section above.

  3. Verify Network Configuration:
    Ensure that the ssrf_proxy_network is properly defined and that the services that need to use the proxy are connected to this network. The network configuration should look like this:

    networks:
      ssrf_proxy_network:
        driver: bridge
        internal: true
    
  4. Set Proxy Environment Variables:
    Ensure that the services that need to use the proxy have the HTTP_PROXY and HTTPS_PROXY environment variables set. For example, in the sandbox service:

    sandbox:
      image: langgenius/dify-sandbox:0.2.1
      restart: always
      environment:
        API_KEY: dify-sandbox
        GIN_MODE: 'release'
        WORKER_TIMEOUT: 15
        ENABLE_NETWORK: 'true'
        HTTP_PROXY: 'http://ssrf_proxy:3128'
        HTTPS_PROXY: 'http://ssrf_proxy:3128'
        SANDBOX_PORT: 8194
      volumes:
        - ./volumes/sandbox/dependencies:/dependencies
      networks:
        - ssrf_proxy_network
    

By ensuring that the ssrf_proxy service is properly configured and running, and that the necessary environment variables are set, you should be able to resolve the "[Error 111] Connection refused" issue [1][2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jun 18, 2024): <!-- Answer --> To resolve the "[Error 111] Connection refused" issue with the HTTP tool and Python requests in Dify version 0.6.10, which is self-hosted using Docker in a private environment without internet access, ensure that the `ssrf_proxy` service is properly configured and running. Here are the steps: 1. **Ensure `ssrf_proxy` Service is Running:** Make sure the `ssrf_proxy` service is defined and running in your `docker-compose.yaml` file. The relevant section should look like this: ```yaml ssrf_proxy: image: ubuntu/squid:latest restart: always ports: - "3128:3128" - "8194:8194" volumes: # Please modify the squid.conf file to fit your network environment. - ./volumes/ssrf_proxy/squid.conf:/etc/squid/squid.conf networks: - ssrf_proxy_network - default ``` 2. **Check `squid.conf` Configuration:** Ensure that the `squid.conf` file is correctly configured to fit your network environment. This file should be mounted to the container as shown in the `volumes` section above. 3. **Verify Network Configuration:** Ensure that the `ssrf_proxy_network` is properly defined and that the services that need to use the proxy are connected to this network. The network configuration should look like this: ```yaml networks: ssrf_proxy_network: driver: bridge internal: true ``` 4. **Set Proxy Environment Variables:** Ensure that the services that need to use the proxy have the `HTTP_PROXY` and `HTTPS_PROXY` environment variables set. For example, in the `sandbox` service: ```yaml sandbox: image: langgenius/dify-sandbox:0.2.1 restart: always environment: API_KEY: dify-sandbox GIN_MODE: 'release' WORKER_TIMEOUT: 15 ENABLE_NETWORK: 'true' HTTP_PROXY: 'http://ssrf_proxy:3128' HTTPS_PROXY: 'http://ssrf_proxy:3128' SANDBOX_PORT: 8194 volumes: - ./volumes/sandbox/dependencies:/dependencies networks: - ssrf_proxy_network ``` By ensuring that the `ssrf_proxy` service is properly configured and running, and that the necessary environment variables are set, you should be able to resolve the "[Error 111] Connection refused" issue <sup>[[1]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.middleware.yaml)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4158