Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to ignore HTTPS certificate verification for HTTP nodes? #10971

Closed
5 tasks done
nooooom opened this issue Nov 22, 2024 · 1 comment
Closed
5 tasks done

How to ignore HTTPS certificate verification for HTTP nodes? #10971

nooooom opened this issue Nov 22, 2024 · 1 comment
Labels
🐞 bug Something isn't working

Comments

@nooooom
Copy link

nooooom commented Nov 22, 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).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.11.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When using HTTP node to access https protocol, the error CERTIFICATE_VERIFY_FAILED is displayed

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

Copy link

dosubot bot commented Nov 22, 2024

To ignore HTTPS certificate verification for HTTP nodes in a self-hosted Dify setup, you can modify the SSL context in your application to bypass certificate verification. Here's a general approach you can take in Python:

  1. Disable SSL Verification: You can disable SSL verification by creating an unverified SSL context. This is generally not recommended for production environments due to security risks, but it can be useful for testing purposes.

    import ssl
    import openai
    
    # Create an unverified SSL context
    ssl_context = ssl._create_unverified_context()
    
    # Configure the OpenAI client to use this SSL context
    openai.api_key = "your-openai-api-key"
    openai.api_base = "https://your-dify-instance-url"
    openai.api_client = openai.OpenAIClient(ssl_context=ssl_context)
    
    # Example API call
    response = openai.Completion.create(
        engine="davinci",
        prompt="Hello, world!",
        max_tokens=5
    )
    print(response.choices[0].text.strip())
  2. Environment Variable: Alternatively, you can set an environment variable to ignore SSL verification. This method depends on the specific libraries and tools you are using.

Remember, bypassing SSL verification can expose your application to man-in-the-middle attacks, so it should only be used in controlled environments where security is not a concern.

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the 🐞 bug Something isn't working label Nov 22, 2024
@langgenius langgenius locked and limited conversation to collaborators Nov 22, 2024
@crazywoola crazywoola converted this issue into discussion #10980 Nov 22, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant