dify icon indicating copy to clipboard operation
dify copied to clipboard

Unable to install plug-ins under proxy environment

Open onaka-ga-pkpk opened this issue 9 months ago • 2 comments

Self Checks

  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

1.1.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Self-hosting dify in our internal network environment. shared-api-worker-env has HTTP_PROXY,HTTPS_PROXY, NO_PROXY(localhost,127.0.0.1, api,woker...etc) were added. I can start and access Didify without any problems, but when I try to install the plugin, I get the following error message. Until v0.15.3, I was able to connect to the outside world this way without problems.

Kit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36" "-"
plugin_daemon-1  | 
plugin_daemon-1  | 2025/03/28 11:30:04 /app/internal/db/pgsql.go:259 record not found
plugin_daemon-1  | [3.690ms] [rows:0] SELECT * FROM "plugin_declarations" WHERE plugin_unique_identifier = 'langgenius/anthropic:0.0.12@327e2045f57542526f16a06c58577461baa01ee415e00916c60641359a56f3a4' ORDER BY "plugin_declarations"."id" LIMIT 1
plugin_daemon-1  | [GIN] 2025/03/28 - 11:30:04 | 200 |    4.827716ms |     172.16.14.8 | GET      "/plugin/4c3432eb-a01e-462f-a529-7a6fa1d70aeb/management/fetch/manifest?plugin_unique_identifier=langgenius%2Fanthropic%3A0.0.12%40327e2045f57542526f16a06c58577461baa01ee415e00916c60641359a56f3a4"
ssrf_proxy-1     | 1743161404.267      3 172.16.14.8 TCP_TUNNEL/503 0 CONNECT marketplace.dify.ai:443 - HIER_NONE/- -
api-1            | 2025-03-28 20:30:04.267 WARNING [Dummy-1] [ssrf_proxy.py:74] - Request to URL https://marketplace.dify.ai/api/v1/plugins/download?unique_identifier=langgenius/anthropic:0.0.12@327e2045f57542526f16a06c58577461baa01ee415e00916c60641359a56f3a4 failed on attempt 1: 503 Service Unavailable
ssrf_proxy-1     | 1743161404.955      0 172.16.14.8 TCP_TUNNEL/503 0 CONNECT marketplace.dify.ai:443 - HIER_NONE/- -
api-1            | 2025-03-28 20:30:04.956 WARNING [Dummy-1] [ssrf_proxy.py:74] - Request to URL https://marketplace.dify.ai/api/v1/plugins/download?unique_identifier=langgenius/anthropic:0.0.12@327e2045f57542526f16a06c58577461baa01ee415e00916c60641359a56f3a4 failed on attempt 2: 503 Service Unavailable
ssrf_proxy-1     | 1743161406.140      0 172.16.14.8 TCP_TUNNEL/503 0 CONNECT marketplace.dify.ai:443 - HIER_NONE/- -
api-1            | 2025-03-28 20:30:06.141 WARNING [Dummy-1] [ssrf_proxy.py:74] - Request to URL https://marketplace.dify.ai/api/v1/plugins/download?unique_identifier=langgenius/anthropic:0.0.12@327e2045f57542526f16a06c58577461baa01ee415e00916c60641359a56f3a4 failed on attempt 3: 503 Service Unavailable
ssrf_proxy-1     | 1743161408.337      0 172.16.14.8 TCP_TUNNEL/503 0 CONNECT marketplace.dify.ai:443 - HIER_NONE/- -
api-1            | 2025-03-28 20:30:08.338 WARNING [Dummy-1] [ssrf_proxy.py:74] - Request to URL https://marketplace.dify.ai/api/v1/plugins/download?unique_identifier=langgenius/anthropic:0.0.12@327e2045f57542526f16a06c58577461baa01ee415e00916c60641359a56f3a4 failed on attempt 4: 503 Service Unavailable
nginx-1          | 10.134.10.5 - - [28/Mar/2025:11:30:08 +0000] "POST /console/api/workspaces/current/plugin/install/marketplace HTTP/1.1" 400 254 "http://10.117.32.137:50080/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36" "-"

Image

✔️ Expected Behavior

Under a proxy environment the plugin installation works with self-hosted dify.

❌ Actual Behavior

No response

onaka-ga-pkpk avatar Mar 28 '25 13:03 onaka-ga-pkpk

I found some similar threads that might help with your issue:

  1. Help with proxy issues for configuring models - This discussion is unsolved but might provide some insights into proxy configurations.

  2. cannot access the plugin marketplace - This open issue suggests configuring a proxy in the docker/.env file to resolve access issues. It involves setting environment variables to enable the proxy, allowing the download of plugins, and then reverting the settings after downloading.

  3. How to fix plugin installation failures in Dify 1.0.0? - This issue provides a detailed solution for plugin installation failures under a proxy:

    • Extend the Python environment initialization timeout by adding PYTHON_ENV_INIT_TIMEOUT: 320 to your docker-compose.yaml under the plugin_daemon service.
    • Ensure a stable network connection and verify connectivity to marketplace.dify.ai.
    • Check your SSL configuration and ensure HTTP_PROXY and HTTPS_PROXY are correctly set.

These solutions might help you resolve the 503 Service Unavailable error you're encountering during plugin installation under a proxy environment [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar Mar 28 '25 13:03 dosubot[bot]

This issue is related to the following issue. https://github.com/langgenius/dify/issues/16052#issuecomment-2733655376

camucamulemon7 avatar Mar 30 '25 15:03 camucamulemon7

请问解决了吗,我也是内网部署,配置http_proxy访问market,而且旧版本正常访问,升级后跟你一模一样的问题,求help!

IAOTW avatar Apr 09 '25 03:04 IAOTW

I have the same issue, with 1.1.3 and 0.0.6-local plugin daemon. This issue should be reopen, I think.

jskcnsl avatar Apr 09 '25 16:04 jskcnsl

I’m working around the issue by using the 0.0.3-local plugin daemon. However, version 0.0.3 has a bug that causes it to consume a large amount of memory: https://github.com/langgenius/dify/issues/15137

It’s quite a hassle, but I install the plugin using version 0.0.3, then restart with 0.0.6 to actually use it. It would be very helpful if this could be fixed.

camucamulemon7 avatar Apr 10 '25 14:04 camucamulemon7

@jskcnsl @camucamulemon7 @kouyakamada Update the configurations in the .env file:

# SSRF Proxy server HTTP URL
# SSRF_PROXY_HTTP_URL=http://ssrf_proxy:3128
SSRF_PROXY_HTTP_URL=${your http_proxy}
# SSRF Proxy server HTTPS URL
# SSRF_PROXY_HTTPS_URL=http://ssrf_proxy:3128
SSRF_PROXY_HTTPS_URL=${your http_proxy}

Also, the container's environment configurations in docker-compose.yaml need to be updated with http_proxy, https_proxy, and no_proxy.

IAOTW avatar Apr 10 '25 16:04 IAOTW

The SSRF proxy configuration is set using the following file: https://github.com/langgenius/dify/blob/main/docker/ssrf_proxy/squid.conf.template

camucamulemon7 avatar Apr 10 '25 16:04 camucamulemon7

SSRF 代理配置使用以下文件进行设置:https://github.com/langgenius/dify/blob/main/docker/ssrf_proxy/squid.conf.template

Yes, but you should set your HTTP proxy in the .env file using the SSRF_PROXY_HTTP_URL and SSRF_PROXY_HTTPS_URL variables.

IAOTW avatar Apr 10 '25 16:04 IAOTW

@jskcnsl @camucamulemon7 @kouyakamada Update the configurations in the .env file:

# SSRF Proxy server HTTP URL
# SSRF_PROXY_HTTP_URL=http://ssrf_proxy:3128
SSRF_PROXY_HTTP_URL=${your http_proxy}
# SSRF Proxy server HTTPS URL
# SSRF_PROXY_HTTPS_URL=http://ssrf_proxy:3128
SSRF_PROXY_HTTPS_URL=${your http_proxy}

Also, the container's environment configurations in docker-compose.yaml need to be updated with http_proxy, https_proxy, and no_proxy.

非常感谢,这个在.env中设置成自己的代理服务器就可以访问代理了好像:

Image

babyfengfjx avatar Apr 14 '25 08:04 babyfengfjx