How to skip or fix SSL cert verification error #4600
Replies: 5 comments 3 replies
-
Beta Was this translation helpful? Give feedback.
-
install the root certificate inside container, after that everything should be fine. your changes doesn’t follow the security best practices, you could be attacked by DNS spoofing. |
Beta Was this translation helpful? Give feedback.
-
Hi guys and all future readers, Before providing my solutions I woud like to emphasise, that using certificates issued by verified CA authorities should be always your solution (Let's Encrypt certs are free). However if you find yourself in a situation when you have no other option than using a self-signed CA, here is my story: I got the same error when my custom tool used self-signed certificate. The problem here is that Dify uses The The only workaround that made Dify trust my CA was to build my own image with copy of my CA certificate appended to the end of the CA bundle used by certifi. This is how I did it: FROM langgenius/dify-api:0.6.8
COPY ./certs/my_awesome_CA.crt /usr/local/share/ca-certificates/
RUN update-ca-certificates # add to system CAs, probably not needed but can be useful
RUN cat /usr/local/share/ca-certificates/my_awesome_CA.crt >> /usr/local/lib/python3.10/site-packages/certifi/cacert.pem
WORKDIR /app/api
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] Check what CA bundle certifi on your machine uses: import certifi
certifi.where() Do not use this in a production environment. I repeat, use a certificate issued by verified certification authority whenever possible! |
Beta Was this translation helpful? Give feedback.
-
Hi, Is there anyone still dealing with this error? I came up with it a few days ago, and my dify version is 0.6.11. The error is on the http request node instead of the LLM node. I tried to fix the problem by adding the line in dify/api/workflow/nodes/http_request/http_executor.py by adding the argument 'verify', to ignore the SSL verification for httpx: def _do_http_request(self, headers: dict[str, Any]) -> httpx.Response:
"""
do http request depending on api bundle
"""
kwargs = {
'url': self.server_url,
'headers': headers,
'params': self.params,
'timeout': (self.timeout.connect, self.timeout.read, self.timeout.write),
'follow_redirects': True,
'verify': False # Disable SSL verification for httpx
}
if self.method in ('get', 'head', 'options'):
response = getattr(ssrf_proxy, self.method)(**kwargs)
elif self.method in ('post', 'put', 'delete', 'patch'):
response = getattr(ssrf_proxy, self.method)(data=self.body, files=self.files, **kwargs)
else:
raise ValueError(f'Invalid http method {self.method}')
return response But that didn't work. |
Beta Was this translation helpful? Give feedback.
-
Resolution that worked for me. Steps to Resolve:
Key Additions:
Additional Information:Dify has switched from By following these steps, you should be able to resolve the SSL certificate issue effectively. Feel free to reach out if you have any further questions or need additional assistance. |
Beta Was this translation helpful? Give feedback.
-
when i save openai provider with API Base(openai_api_base,base_url), got connection error, message is following
httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)
i try to use openai SDK test my setting, got correct result
at logs found some init logic, but dont know how to update this logic
related issue
Beta Was this translation helpful? Give feedback.
All reactions