Open blackwhite084 opened 1 day ago
the sandbox is running,docker exec -it ---> curl -f http://localhost:8194/health is ok
Hey @blackwhite084! I'm here to help you with any issues you encounter. I'm a bot that can assist you with bugs, questions, and contributions while you wait for a human maintainer.
I found some similar discussions that might be relevant to your issue:
The "502 Bad Gateway" error is likely due to a misconfiguration in the reverse proxy settings. Ensure that the cache_peer
directive in the Squid configuration is set to the actual IP address or hostname of the sandbox server instead of sandbox
.
Here is the relevant part of the configuration:
################################## Reverse Proxy To Sandbox ################################
http_port 8194 accel vhost
cache_peer <sandbox_ip_or_hostname> parent 8194 0 no-query originserver
acl src_all src all
http_access allow src_all
Additionally, ensure that the SSRF_SANDBOX_HOST
environment variable in your .env
file is correctly set to the actual hostname or IP address of the sandbox server:
# Environment Variables for SSRF Proxy
SSRF_HTTP_PORT=3128
SSRF_COREDUMP_DIR=/var/spool/squid
SSRF_REVERSE_PROXY_PORT=8194
SSRF_SANDBOX_HOST=<sandbox_ip_or_hostname>
Also, verify that the SANDBOX_PORT
environment variable in your docker-compose.yaml
file is set to 8194
and that the HTTP_PROXY
and HTTPS_PROXY
environment variables are correctly pointing to the SSRF proxy:
# The DifySandbox
sandbox:
image: langgenius/dify-sandbox:0.2.9
restart: always
environment:
API_KEY: ${SANDBOX_API_KEY:-dify-sandbox}
GIN_MODE: ${SANDBOX_GIN_MODE:-release}
WORKER_TIMEOUT: ${SANDBOX_WORKER_TIMEOUT:-15}
ENABLE_NETWORK: ${SANDBOX_ENABLE_NETWORK:-true}
HTTP_PROXY: ${SANDBOX_HTTP_PROXY:-http://ssrf_proxy:3128}
HTTPS_PROXY: ${SANDBOX_HTTPS_PROXY:-http://ssrf_proxy:3128}
SANDBOX_PORT: ${SANDBOX_PORT:-8194}
volumes:
- ./volumes/sandbox/dependencies:/dependencies
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8194/health" ]
networks:
- ssrf_proxy_network
After making these changes, restart the Squid service and the Docker containers to apply the new configuration [4][5][6][7].
To continue talking to Dosu, mention @dosu.
Self Checks
Dify version
0.8.2
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
api-1 | 2024-09-18 15:30:24,368.368 INFO [Dummy-1] [_client.py:1038] - HTTP Request: POST http://sandbox:8194/v1/sandbox/run "HTTP/1.1 502 Bad Gateway"
✔️ Expected Behavior
run the code
❌ Actual Behavior
No response