Unable to connect to Huawei ModelArts from private infrastructure #634

Closed
opened 2026-02-16 10:19:59 -05:00 by yindo · 6 comments
Owner

Originally created by @xzneozx96 on GitHub (Sep 10, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.6.0

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Hi Team,

We’re experiencing issues connecting to the ModelArts LLM from our private Huawei-provided infrastructure. From our investigation, this seems related to our custom integration rather than ModelArts itself.

Step to reproduce:

  1. Install Huawei Cloud MASS plugin
  2. Authorize the plugin with proper credentials

Currently, when attempting to connect, we encounter an error. The Huawei team suggested bypassing it by using the following approach:
request.post(url, json=data, headers=headers, timeout=360, **verify=False**

The challenge is that we’re unsure where in our codebase this change should be applied. Could you please advise us on the correct way to implement this fix?

Image

✔️ Expected Behavior

Able to bypass the SSL error with custom code snippet

Actual Behavior

No response

Originally created by @xzneozx96 on GitHub (Sep 10, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.6.0 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce Hi Team, We’re experiencing issues connecting to the ModelArts LLM from our private Huawei-provided infrastructure. From our investigation, this seems related to our custom integration rather than ModelArts itself. **Step to reproduce:** 1. Install Huawei Cloud MASS plugin 2. Authorize the plugin with proper credentials Currently, when attempting to connect, we encounter an error. The Huawei team suggested bypassing it by using the following approach: `request.post(url, json=data, headers=headers, timeout=360, **verify=False**` The challenge is that we’re unsure where in our codebase this change should be applied. Could you please advise us on the correct way to implement this fix? <img width="415" height="258" alt="Image" src="https://github.com/user-attachments/assets/9bfcbd7b-96bb-4afe-9c21-6a146e5f5fc8" /> ### ✔️ Expected Behavior Able to bypass the SSL error with custom code snippet ### ❌ Actual Behavior _No response_
yindo added the bug label 2026-02-16 10:19:59 -05:00
yindo closed this issue 2026-02-16 10:19:59 -05:00
Author
Owner

@xzneozx96 commented on GitHub (Sep 11, 2025):

hi @dosubot, can you help with this?

@xzneozx96 commented on GitHub (Sep 11, 2025): hi @dosubot, can you help with this?
Author
Owner

@dosubot[bot] commented on GitHub (Sep 11, 2025):

To bypass the SSL verification error for Huawei ModelArts in your Dify setup, you should edit the Huawei Cloud MASS plugin code—specifically, the HuaWeiCloudMaaSModel.invoke method in models/huaweicloud_maas/models/llm/model.py. In the requests.post call that sends requests to ModelArts, add the parameter verify=False. This will disable SSL certificate checks for these requests only.

Example:

response = requests.post(url, json=data, headers=headers, timeout=360, verify=False)

Important: Disabling SSL verification exposes you to security risks like man-in-the-middle attacks and data leaks. Only use this workaround in trusted, private environments—not in production. If possible, consider installing the correct CA certificates or using http:// instead of https:// for testing, though this may not be supported by ModelArts. For more on the risks and best practices, see this discussion.

If you update the plugin code, restart your services to apply the change. If you still see errors, double-check the plugin version and confirm the edit is in the right place.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 11, 2025): <!-- Answer --> To bypass the SSL verification error for Huawei ModelArts in your Dify setup, you should edit the Huawei Cloud MASS plugin code—specifically, the `HuaWeiCloudMaaSModel.invoke` method in `models/huaweicloud_maas/models/llm/model.py`. In the `requests.post` call that sends requests to ModelArts, add the parameter `verify=False`. This will disable SSL certificate checks for these requests only. **Example:** ```python response = requests.post(url, json=data, headers=headers, timeout=360, verify=False) ``` **Important:** Disabling SSL verification exposes you to security risks like man-in-the-middle attacks and data leaks. Only use this workaround in trusted, private environments—not in production. If possible, consider installing the correct CA certificates or using `http://` instead of `https://` for testing, though this may not be supported by ModelArts. For more on the risks and best practices, see [this discussion](https://github.com/langgenius/dify-docs/issues/114#issuecomment-2896473073). If you update the plugin code, restart your services to apply the change. If you still see errors, double-check the plugin version and confirm the edit is in the right place. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/f7c4742d-d9d5-456e-9bee-ba60c6628e0c?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/f7c4742d-d9d5-456e-9bee-ba60c6628e0c?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/f7c4742d-d9d5-456e-9bee-ba60c6628e0c?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/f7c4742d-d9d5-456e-9bee-ba60c6628e0c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f7c4742d-d9d5-456e-9bee-ba60c6628e0c?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/f7c4742d-d9d5-456e-9bee-ba60c6628e0c?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f7c4742d-d9d5-456e-9bee-ba60c6628e0c?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/25509)
Author
Owner

@xzneozx96 commented on GitHub (Sep 11, 2025):

can not find any logic like this from the HuaweiCloud Mass Plugin, seem it's abstracted away @dosubot

@xzneozx96 commented on GitHub (Sep 11, 2025): can not find any logic like this from the HuaweiCloud Mass Plugin, seem it's abstracted away @dosubot
Author
Owner

@dosubot[bot] commented on GitHub (Sep 11, 2025):

You're right—the HuaweiCloud MASS plugin doesn't expose direct HTTP request logic like requests.post in its code. Instead, it relies on a shared library (dify_plugin) that abstracts HTTP calls, likely using httpx under the hood. This means you can't simply add verify=False in the plugin code itself.

Currently, the Dify platform does not support disabling SSL verification for outbound requests at the plugin or platform level for security reasons, and this option isn't exposed in the plugin's configuration or credential schema. Any change to SSL verification would require modifying the shared library or monkey-patching the HTTP client at runtime, which is not recommended for production use due to security risks (source).

As a workaround, some users have solved SSL verification problems by setting a custom CA file in the plugin daemon container's certifi module path, but this isn't always possible for compressed or compiled plugin packages (source). If you need to bypass SSL verification for testing, you would need to patch the shared HTTP client or adjust the environment to trust the certificate, but there is no simple config or code change in the plugin itself.

Let me know if you want details on patching httpx or setting up custom CA certificates for your environment.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 11, 2025): <!-- Answer --> You're right—the HuaweiCloud MASS plugin doesn't expose direct HTTP request logic like `requests.post` in its code. Instead, it relies on a shared library (`dify_plugin`) that abstracts HTTP calls, likely using `httpx` under the hood. This means you can't simply add `verify=False` in the plugin code itself. Currently, the Dify platform does not support disabling SSL verification for outbound requests at the plugin or platform level for security reasons, and this option isn't exposed in the plugin's configuration or credential schema. Any change to SSL verification would require modifying the shared library or monkey-patching the HTTP client at runtime, which is not recommended for production use due to security risks ([source](https://github.com/langgenius/dify-docs/issues/114#issuecomment-2896473073)). As a workaround, some users have solved SSL verification problems by setting a custom CA file in the plugin daemon container's certifi module path, but this isn't always possible for compressed or compiled plugin packages ([source](https://github.com/langgenius/dify-official-plugins/issues/253)). If you need to bypass SSL verification for testing, you would need to patch the shared HTTP client or adjust the environment to trust the certificate, but there is no simple config or code change in the plugin itself. Let me know if you want details on patching `httpx` or setting up custom CA certificates for your environment. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/9aafe305-18f6-4946-a241-b2675232a2bc?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/9aafe305-18f6-4946-a241-b2675232a2bc?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/9aafe305-18f6-4946-a241-b2675232a2bc?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/9aafe305-18f6-4946-a241-b2675232a2bc?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/9aafe305-18f6-4946-a241-b2675232a2bc?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/9aafe305-18f6-4946-a241-b2675232a2bc?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/9aafe305-18f6-4946-a241-b2675232a2bc?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/25509)
Author
Owner

@xzneozx96 commented on GitHub (Sep 11, 2025):

pls give me solution on patching httpx @dosubot

@xzneozx96 commented on GitHub (Sep 11, 2025): pls give me solution on patching httpx @dosubot
Author
Owner

@dosubot[bot] commented on GitHub (Sep 11, 2025):

To patch httpx and disable SSL verification for all outbound requests in your plugin environment, you need to modify the shared HTTP client logic. Since the HuaweiCloud MASS plugin uses an abstracted HTTP layer, the most effective approach is to patch the httpx client at the shared utility level.

One method is to override the default HTTPS context globally in Python. For example, you can add this at the very top of your plugin's entrypoint (before any HTTP requests are made):

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

This disables SSL verification for all HTTPS requests in Python, including those made by httpx, as long as httpx uses the default SSL context. This approach is used in other plugins (like Azure AI Studio) to bypass SSL verification for testing or in trusted environments.

Warning: Disabling SSL verification exposes you to security risks (e.g., man-in-the-middle attacks). Only use this in isolated, trusted environments.

If you want to patch httpx more specifically, you would need to locate where the httpx.Client or httpx.AsyncClient is instantiated in the shared dify_plugin code (often in a file like api/core/helper/ssrf_proxy.py), and set verify=False in the client or transport initialization. This change will cascade to all outbound requests using that client.

After making the change, restart your plugin daemon or container to apply it.

There are no environment variables or config options to control SSL verification globally for plugins—code-level patching is required for this use case. For more details, see this example.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 11, 2025): <!-- Answer --> To patch httpx and disable SSL verification for all outbound requests in your plugin environment, you need to modify the shared HTTP client logic. Since the HuaweiCloud MASS plugin uses an abstracted HTTP layer, the most effective approach is to patch the httpx client at the shared utility level. One method is to override the default HTTPS context globally in Python. For example, you can add this at the very top of your plugin's entrypoint (before any HTTP requests are made): ```python import ssl ssl._create_default_https_context = ssl._create_unverified_context ``` This disables SSL verification for all HTTPS requests in Python, including those made by httpx, as long as httpx uses the default SSL context. This approach is used in other plugins (like Azure AI Studio) to bypass SSL verification for testing or in trusted environments. **Warning:** Disabling SSL verification exposes you to security risks (e.g., man-in-the-middle attacks). Only use this in isolated, trusted environments. If you want to patch httpx more specifically, you would need to locate where the httpx.Client or httpx.AsyncClient is instantiated in the shared dify_plugin code (often in a file like `api/core/helper/ssrf_proxy.py`), and set `verify=False` in the client or transport initialization. This change will cascade to all outbound requests using that client. After making the change, restart your plugin daemon or container to apply it. There are no environment variables or config options to control SSL verification globally for plugins—code-level patching is required for this use case. For more details, see [this example](https://github.com/langgenius/dify-official-plugins/blob/332877667d20ebeb01d918bf9bf25b390b8ef2c7/models/azure_ai_studio/models/rerank/rerank.py). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/0d853c85-c78c-488b-a6b2-cf7a9642207a?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/0d853c85-c78c-488b-a6b2-cf7a9642207a?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/0d853c85-c78c-488b-a6b2-cf7a9642207a?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/0d853c85-c78c-488b-a6b2-cf7a9642207a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0d853c85-c78c-488b-a6b2-cf7a9642207a?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/0d853c85-c78c-488b-a6b2-cf7a9642207a?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/0d853c85-c78c-488b-a6b2-cf7a9642207a?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/25509)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#634