INFO: 172.17.0.1:50316 - "GET /openai/api/models HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /litellm/api/v1/models HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/modelfiles/ HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/prompts/ HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/documents/ HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/chats/tags/all HTTP/1.1" 200 OK
INFO:apps.ollama.main:get_all_models()
Screenshots (if applicable):
Installation Method
Docker vanilla install with Open API key
Additional Information
[Include any additional details that may help in understanding and reproducing the issue. This could include specific configurations, error messages, or anything else relevant to the bug.]
Note
If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!
Originally created by @GillesBodart on GitHub (Apr 2, 2024).
# Bug Report
## Description
When you run the docker image in an enterprise context, based on the company policy, you may have SSL interception in order to anlyse the traffic
**Bug Summary:**
Impossible to add some CA to the internal trustore used to make the REST API request
**Steps to Reproduce:**
need to have SSL interception enable on your laptop that breaks the SSL chain
**Expected Behavior:**
Possibility to add CA to the used truststore
**Actual Behavior:**
CA can't be added
## Environment
- **Windows 11 running docker image ghcr.io/open-webui/open-webui:main
- **Browser Chrome
## Reproduction Details
**Confirmation:**
- [* ] I have read and followed all the instructions provided in the README.md.
- [* ] I am on the latest version of both Open WebUI and Ollama.
- [* ] I have included the browser console logs.
- [ *] I have included the Docker container logs.
## Logs and Screenshots
**Browser Console Logs:**
{
"detail": "Something went wrong :/\nHTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/images/generations (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')))"
}
**Docker Container Logs:**
INFO: 172.17.0.1:50270 - "GET /ollama/api/tags HTTP/1.1" 200 OK
INFO:apps.openai.main:get_all_models()
ERROR:apps.openai.main:Connection error: Cannot connect to host api.openai.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')]
INFO:apps.openai.main:models: {'data': []}
INFO:apps.openai.main:get_all_models()
ERROR:apps.openai.main:Connection error: Cannot connect to host api.openai.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')]
INFO:apps.openai.main:models: {'data': []}
INFO: 172.17.0.1:50270 - "GET /openai/api/models HTTP/1.1" 200 OK
INFO: 172.17.0.1:50270 - "GET /litellm/api/v1/models HTTP/1.1" 200 OK
INFO: 172.17.0.1:50294 - "GET /_app/immutable/nodes/8.0396dff0.js HTTP/1.1" 200 OK
INFO: 172.17.0.1:50298 - "GET /ollama/api/version HTTP/1.1" 200 OK
INFO: 172.17.0.1:50304 - "GET /ollama/api/version HTTP/1.1" 200 OK
INFO: 172.17.0.1:50304 - "GET /ollama/urls HTTP/1.1" 200 OK
INFO: 172.17.0.1:50304 - "GET /ollama/api/version HTTP/1.1" 200 OK
INFO: 172.17.0.1:50304 - "GET /litellm/api/model/info HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/config HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/auths/ HTTP/1.1" 200 OK
INFO:apps.ollama.main:get_all_models()
INFO: 172.17.0.1:50316 - "GET /ollama/api/tags HTTP/1.1" 200 OK
INFO:apps.openai.main:get_all_models()
ERROR:apps.openai.main:Connection error: Cannot connect to host api.openai.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')]
INFO:apps.openai.main:models: {'data': []}
INFO:apps.openai.main:get_all_models()
ERROR:apps.openai.main:Connection error: Cannot connect to host api.openai.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')]
INFO:apps.openai.main:models: {'data': []}
INFO: 172.17.0.1:50316 - "GET /openai/api/models HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /litellm/api/v1/models HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/modelfiles/ HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/prompts/ HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/documents/ HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/chats/tags/all HTTP/1.1" 200 OK
INFO:apps.ollama.main:get_all_models()
**Screenshots (if applicable):**

## Installation Method
Docker vanilla install with Open API key
## Additional Information
[Include any additional details that may help in understanding and reproducing the issue. This could include specific configurations, error messages, or anything else relevant to the bug.]
## Note
If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!
@strikeoncmputrz commented on GitHub (Apr 4, 2024):
This would be an excellent feature. I'd rather not have to run my openai compatible inference server in http mode but I'm using a private public key infrastructure
@strikeoncmputrz commented on GitHub (Apr 4, 2024):
This would be an excellent feature. I'd rather not have to run my openai compatible inference server in http mode but I'm using a private public key infrastructure
@theobjectivedad commented on GitHub (Jun 19, 2024):
For folks stuck on this, here is a quick hack you can use ... basically you can just map /etc/ssl/certs/ca-certificates.crt in the container to a another file that contains your own trust chain.
In this example, I have my internal root CA trusted on the host machine and can map it directly into the container (don't forget to make it read only just in case):
For a larger-scale deployment you can basically do the same thing, ex in Kubernetes maybe you are using something like trust-manager to manage your truststore within the cluster. You can mount the trust-manager managed bundle to /etc/ssl/certs/ca-certificates.crt inside the open webui pod.
This isn't a best practice and and environment variable configuration to add an additional truststore would be cleaner but this will work in the interim. As an aside, I tried to set REQUESTS_CA_BUNDLE in the environment but it didn't work for me.
@theobjectivedad commented on GitHub (Jun 19, 2024):
For folks stuck on this, here is a quick hack you can use ... basically you can just map ``/etc/ssl/certs/ca-certificates.crt`` in the container to a another file that contains your own trust chain.
In this example, I have my internal root CA trusted on the host machine and can map it directly into the container (don't forget to make it read only just in case):
```shell
docker run -it --rm \
--publish=3000:8080 \
--volume=open-webui:/app/backend/data \
--volume=/etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt:ro \
ghcr.io/open-webui/open-webui:main
```
For a larger-scale deployment you can basically do the same thing, ex in Kubernetes maybe you are using something like [trust-manager](https://cert-manager.io/docs/trust/trust-manager/) to manage your truststore within the cluster. You can mount the trust-manager managed bundle to ``/etc/ssl/certs/ca-certificates.crt`` inside the open webui pod.
This isn't a best practice and and environment variable configuration to add an additional truststore would be cleaner but this will work in the interim. As an aside, I tried to set ``REQUESTS_CA_BUNDLE`` in the environment but it didn't work for me.
I'm not able to get the fix above to work, I've pulled my CA bundle from my AD Domain and added it into the container as mentioned above, however I still get a SSL: CERTIFICATE_VERIFY_FAILED error. ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)
however I did notice that the above method allows me to curl the .well-known address without having to ignore validation. It just seems like Open WebUI doesn't also respect that the CA root for my domain is trusted once added to the container CA trust.
I'm running Open WebUI 0.3.7, and Authentik 2024.4.7 behind a NGINX reverse proxy.
@hanahige commented on GitHub (Jul 16, 2024):
I'm not able to get the fix above to work, I've pulled my CA bundle from my AD Domain and added it into the container as mentioned above, however I still get a SSL: CERTIFICATE_VERIFY_FAILED error.
`ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)`
however I did notice that the above method allows me to curl the .well-known address without having to ignore validation. It just seems like Open WebUI doesn't also respect that the CA root for my domain is trusted once added to the container CA trust.
I'm running Open WebUI 0.3.7, and Authentik 2024.4.7 behind a NGINX reverse proxy.
where /etc/containers/openwebui/compusrv.crt is simply my self-signed certificate (i.e. you don't even need to build a full truststore, if you don't want to).
@KizzyCode commented on GitHub (Jul 30, 2024):
FWIW, you can force python to use the system certificate store via `REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt` in the environment.
My (trimmed down) docker-compose.yml looks like this:
```yml
services:
openwebui:
image: ghcr.io/open-webui/open-webui:main
volumes:
- /var/containers/openwebui:/app/backend/data:rw
- /etc/containers/openwebui/compusrv.crt:/etc/ssl/certs/ca-certificates.crt:ro
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
- WEBUI_NAME=compusrv
- ENABLE_SIGNUP=False
- ENABLE_COMMUNITY_SHARING=False
- WEBUI_SESSION_COOKIE_SAME_SITE=strict
- WEBUI_SESSION_COOKIE_SECURE=True
- ENABLE_OLLAMA_API=False
- REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
```
where `/etc/containers/openwebui/compusrv.crt` is simply my self-signed certificate (i.e. you don't even need to build a full truststore, if you don't want to).
As an alternative to what @KizzyCode said and @theobjectivedad said about setting the REQUESTS_CA_BUNDLE env + mounting the host store, you can also add the following commands in the Dockerfile
COPY <CorporateSSL.crt> /usr/local/share/ca-certificates/
RUN update-ca-certificates
Note that if you're building with the Dockerfile, you will also need to add the cert for the frontend build stage
@nomppy commented on GitHub (Jul 30, 2024):
As an alternative to what @KizzyCode said and @theobjectivedad said about setting the `REQUESTS_CA_BUNDLE` env + mounting the host store, you can also add the following commands in the Dockerfile
```
COPY <CorporateSSL.crt> /usr/local/share/ca-certificates/
RUN update-ca-certificates
```
btw, I also have set
```
ENV PIP_CERT=/etc/ssl/certs/ca-certificates.crt \
REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
```
Note that if you're building with the Dockerfile, you will also need to add the cert for the frontend `build` stage
where /etc/containers/openwebui/compusrv.crt is simply my self-signed certificate (i.e. you don't even need to build a full truststore, if you don't want to).
Sadly, this does not work for me...
i still get SSL: CERTIFICATE_VERIFY_FAILED if i hit "Continue with OAuth2" on login screen
@christiangierschner commented on GitHub (Aug 6, 2024):
> FWIW, you can force python to use the system certificate store via `REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt` in the environment.
>
> My (trimmed down) docker-compose.yml looks like this:
>
> ```yaml
> services:
> openwebui:
> image: ghcr.io/open-webui/open-webui:main
> volumes:
> - /var/containers/openwebui:/app/backend/data:rw
> - /etc/containers/openwebui/compusrv.crt:/etc/ssl/certs/ca-certificates.crt:ro
> - /etc/timezone:/etc/timezone:ro
> - /etc/localtime:/etc/localtime:ro
> environment:
> - WEBUI_NAME=compusrv
> - ENABLE_SIGNUP=False
> - ENABLE_COMMUNITY_SHARING=False
> - WEBUI_SESSION_COOKIE_SAME_SITE=strict
> - WEBUI_SESSION_COOKIE_SECURE=True
> - ENABLE_OLLAMA_API=False
> - REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
> ```
>
> where `/etc/containers/openwebui/compusrv.crt` is simply my self-signed certificate (i.e. you don't even need to build a full truststore, if you don't want to).
Sadly, this does not work for me...
i still get SSL: CERTIFICATE_VERIFY_FAILED if i hit "Continue with OAuth2" on login screen
however if i exec into the container, this works:
```
>>> import requests
>>> response = requests.get('https://internal-keycloak-url/auth')
>>> print(response)
<Response [200]>
```
seems like webui is somehow not using the rootca
any ideas?
Is /usr/local/share/ca-certificates/roocat.crt the complete CA used by your system. If it's just your custom root CA, then you are not giving python any of the usual certs usually present in /etc/ssl/certs/ca-certificates.crt.
Can you try update-ca-certificates on your host and then mapping /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt:ro?
@nomppy commented on GitHub (Aug 7, 2024):
Is `/usr/local/share/ca-certificates/roocat.crt` the complete CA used by your system. If it's just your custom root CA, then you are not giving python any of the usual certs usually present in /etc/ssl/certs/ca-certificates.crt.
Can you try `update-ca-certificates` on your host and then mapping `/etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt:ro`?
Can you manually check that /etcssl/certs/ca-certificates.crt contains the cert in rootca.crt?
How did you obtain rootca.crt?
Do you can SSL error only when you click login with oAuth, or also for other things? I.e., can you try to log in with username/password and see if you get an error for requests to e.g. OpenAI?
@nomppy commented on GitHub (Aug 9, 2024):
- Can you manually check that `/etcssl/certs/ca-certificates.crt` contains the cert in rootca.crt?
- How did you obtain `rootca.crt`?
- Do you can SSL error only when you click login with oAuth, or also for other things? I.e., can you try to log in with username/password and see if you get an error for requests to e.g. OpenAI?
AND
-e REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
After that, the Openweb-ui accepted the connections and it worked.
@bkev commented on GitHub (Aug 10, 2024):
After struggling with this myself, thanks for the pointers in here.
What fixed this for me was
I copied the root.crt (from Caddy) to my Linux device and put it in /usr/local/share/ca-certificates
I then ran sudo update-ca-certificates which said it had added one cert.
After playing about, the only options that seemed to work me for me was adding these to my docker run command
-v /link/to/my/cert.crt:/etc/ssl/certs/ca-certificates.crt:ro
AND
-e REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
After that, the Openweb-ui accepted the connections and it worked.
@christiangierschner commented on GitHub (Aug 12, 2024):
Can you manually check that /etcssl/certs/ca-certificates.crt contains the cert in rootca.crt?
How did you obtain rootca.crt?
Do you can SSL error only when you click login with oAuth, or also for other things? I.e., can you try to log in with username/password and see if you get an error for requests to e.g. OpenAI?
Yes, it contains the cert.
I got it from our rootca server and we use it in all our servers and deployments via ansible. It works.
I only get the error, when i click on login with OAuth. Open-webui then connects to our internal keycloak secured with a signed cert from our rootca.
@christiangierschner commented on GitHub (Aug 12, 2024):
> * Can you manually check that `/etcssl/certs/ca-certificates.crt` contains the cert in rootca.crt?
>
> * How did you obtain `rootca.crt`?
>
> * Do you can SSL error only when you click login with oAuth, or also for other things? I.e., can you try to log in with username/password and see if you get an error for requests to e.g. OpenAI?
Yes, it contains the cert.
I got it from our rootca server and we use it in all our servers and deployments via ansible. It works.
I only get the error, when i click on login with OAuth. Open-webui then connects to our internal keycloak secured with a signed cert from our rootca.
@christiangierschner and all the future people struggling with OAuth and custom CA certs.
It was able to deduce from the logs that OAuth does not use requests as its client module, but httpx instead. httpx documentation explains that custom CA certs could be used by using environment variable SSL_CERT_FILE. I was able to resolve my cert issue by adding:
environment:# ...# other values- SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
to docker compose.
@ebakoba commented on GitHub (Aug 14, 2024):
@christiangierschner and all the future people struggling with OAuth and custom CA certs.
It was able to deduce from the logs that OAuth does not use `requests` as its client module, but `httpx` instead. `httpx` documentation explains that custom CA certs could be used by using environment variable `SSL_CERT_FILE`. I was able to resolve my cert issue by adding:
```yml
environment:
# ...
# other values
- SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
```
to docker compose.
I had similar problem in testing OWUI in an enterprise setting. What ever I tried, I was unable to connect to openai's api end points. This is what finally fixed my issue. If this looks like a useful solution, i'd be happy to create a pull request.
Updated open_webui/routers/openai.py and added the following in the start.
Then where ever I found a session.get or session.request I added ssl=ssl_context.
2. set the env variable SSL_CERT_FILE to /etc/ssl/certs/ca-bundle.crt
Now I'm able to connect to openai api endpoints.
@idling-mind commented on GitHub (Feb 6, 2025):
I had similar problem in testing OWUI in an enterprise setting. What ever I tried, I was unable to connect to openai's api end points. This is what finally fixed my issue. If this looks like a useful solution, i'd be happy to create a pull request.
1. Updated `open_webui/routers/openai.py` and added the following in the start.
```python
...
import ssl
import certifi
ssl_context = ssl.create_default_context(cafile=os.environ.get("SSL_CERT_FILE", certifi.where()))
...
```
Then where ever I found a `session.get` or `session.request` I added `ssl=ssl_context`.
2. set the env variable `SSL_CERT_FILE` to `/etc/ssl/certs/ca-bundle.crt`
Now I'm able to connect to openai api endpoints.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @GillesBodart on GitHub (Apr 2, 2024).
Bug Report
Description
When you run the docker image in an enterprise context, based on the company policy, you may have SSL interception in order to anlyse the traffic
Bug Summary:
Impossible to add some CA to the internal trustore used to make the REST API request
Steps to Reproduce:
need to have SSL interception enable on your laptop that breaks the SSL chain
Expected Behavior:
Possibility to add CA to the used truststore
Actual Behavior:
CA can't be added
Environment
Reproduction Details
Confirmation:
Logs and Screenshots
Browser Console Logs:
{
"detail": "Something went wrong :/\nHTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/images/generations (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')))"
}
Docker Container Logs:
INFO: 172.17.0.1:50270 - "GET /ollama/api/tags HTTP/1.1" 200 OK
INFO:apps.openai.main:get_all_models()
ERROR:apps.openai.main:Connection error: Cannot connect to host api.openai.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')]
INFO:apps.openai.main:models: {'data': []}
INFO:apps.openai.main:get_all_models()
ERROR:apps.openai.main:Connection error: Cannot connect to host api.openai.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')]
INFO:apps.openai.main:models: {'data': []}
INFO: 172.17.0.1:50270 - "GET /openai/api/models HTTP/1.1" 200 OK
INFO: 172.17.0.1:50270 - "GET /litellm/api/v1/models HTTP/1.1" 200 OK
INFO: 172.17.0.1:50294 - "GET /_app/immutable/nodes/8.0396dff0.js HTTP/1.1" 200 OK
INFO: 172.17.0.1:50298 - "GET /ollama/api/version HTTP/1.1" 200 OK
INFO: 172.17.0.1:50304 - "GET /ollama/api/version HTTP/1.1" 200 OK
INFO: 172.17.0.1:50304 - "GET /ollama/urls HTTP/1.1" 200 OK
INFO: 172.17.0.1:50304 - "GET /ollama/api/version HTTP/1.1" 200 OK
INFO: 172.17.0.1:50304 - "GET /litellm/api/model/info HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/config HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/auths/ HTTP/1.1" 200 OK
INFO:apps.ollama.main:get_all_models()
INFO: 172.17.0.1:50316 - "GET /ollama/api/tags HTTP/1.1" 200 OK
INFO:apps.openai.main:get_all_models()
ERROR:apps.openai.main:Connection error: Cannot connect to host api.openai.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')]
INFO:apps.openai.main:models: {'data': []}
INFO:apps.openai.main:get_all_models()
ERROR:apps.openai.main:Connection error: Cannot connect to host api.openai.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)')]
INFO:apps.openai.main:models: {'data': []}
INFO: 172.17.0.1:50316 - "GET /openai/api/models HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /litellm/api/v1/models HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/modelfiles/ HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/prompts/ HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/documents/ HTTP/1.1" 200 OK
INFO: 172.17.0.1:50316 - "GET /api/v1/chats/tags/all HTTP/1.1" 200 OK
INFO:apps.ollama.main:get_all_models()
Screenshots (if applicable):
Installation Method
Docker vanilla install with Open API key
Additional Information
[Include any additional details that may help in understanding and reproducing the issue. This could include specific configurations, error messages, or anything else relevant to the bug.]
Note
If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!
@strikeoncmputrz commented on GitHub (Apr 4, 2024):
This would be an excellent feature. I'd rather not have to run my openai compatible inference server in http mode but I'm using a private public key infrastructure
@tjbck commented on GitHub (Apr 14, 2024):
Feel free to make a PR!
@theobjectivedad commented on GitHub (Jun 19, 2024):
For folks stuck on this, here is a quick hack you can use ... basically you can just map
/etc/ssl/certs/ca-certificates.crtin the container to a another file that contains your own trust chain.In this example, I have my internal root CA trusted on the host machine and can map it directly into the container (don't forget to make it read only just in case):
For a larger-scale deployment you can basically do the same thing, ex in Kubernetes maybe you are using something like trust-manager to manage your truststore within the cluster. You can mount the trust-manager managed bundle to
/etc/ssl/certs/ca-certificates.crtinside the open webui pod.This isn't a best practice and and environment variable configuration to add an additional truststore would be cleaner but this will work in the interim. As an aside, I tried to set
REQUESTS_CA_BUNDLEin the environment but it didn't work for me.@hanahige commented on GitHub (Jul 16, 2024):
I'm not able to get the fix above to work, I've pulled my CA bundle from my AD Domain and added it into the container as mentioned above, however I still get a SSL: CERTIFICATE_VERIFY_FAILED error.
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)however I did notice that the above method allows me to curl the .well-known address without having to ignore validation. It just seems like Open WebUI doesn't also respect that the CA root for my domain is trusted once added to the container CA trust.
I'm running Open WebUI 0.3.7, and Authentik 2024.4.7 behind a NGINX reverse proxy.
@KizzyCode commented on GitHub (Jul 30, 2024):
FWIW, you can force python to use the system certificate store via
REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crtin the environment.My (trimmed down) docker-compose.yml looks like this:
where
/etc/containers/openwebui/compusrv.crtis simply my self-signed certificate (i.e. you don't even need to build a full truststore, if you don't want to).@nomppy commented on GitHub (Jul 30, 2024):
As an alternative to what @KizzyCode said and @theobjectivedad said about setting the
REQUESTS_CA_BUNDLEenv + mounting the host store, you can also add the following commands in the Dockerfilebtw, I also have set
Note that if you're building with the Dockerfile, you will also need to add the cert for the frontend
buildstage@christiangierschner commented on GitHub (Aug 6, 2024):
Sadly, this does not work for me...
i still get SSL: CERTIFICATE_VERIFY_FAILED if i hit "Continue with OAuth2" on login screen
however if i exec into the container, this works:
seems like webui is somehow not using the rootca
any ideas?
@nomppy commented on GitHub (Aug 6, 2024):
What does your compose file look like?
@christiangierschner commented on GitHub (Aug 7, 2024):
@nomppy commented on GitHub (Aug 7, 2024):
Is
/usr/local/share/ca-certificates/roocat.crtthe complete CA used by your system. If it's just your custom root CA, then you are not giving python any of the usual certs usually present in /etc/ssl/certs/ca-certificates.crt.Can you try
update-ca-certificateson your host and then mapping/etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt:ro?@christiangierschner commented on GitHub (Aug 9, 2024):
i tried both...none works
our hosts all have our rootca implmented with
update-ca-certificatesi get Internal Server Error and SSL: CERTIFICATE_VERIFY_FAILED
@nomppy commented on GitHub (Aug 9, 2024):
/etcssl/certs/ca-certificates.crtcontains the cert in rootca.crt?rootca.crt?@bkev commented on GitHub (Aug 10, 2024):
After struggling with this myself, thanks for the pointers in here.
What fixed this for me was
I copied the root.crt (from Caddy) to my Linux device and put it in /usr/local/share/ca-certificates
I then ran sudo update-ca-certificates which said it had added one cert.
After playing about, the only options that seemed to work me for me was adding these to my docker run command
-v /link/to/my/cert.crt:/etc/ssl/certs/ca-certificates.crt:ro
AND
-e REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
After that, the Openweb-ui accepted the connections and it worked.
@christiangierschner commented on GitHub (Aug 12, 2024):
Yes, it contains the cert.
I got it from our rootca server and we use it in all our servers and deployments via ansible. It works.
I only get the error, when i click on login with OAuth. Open-webui then connects to our internal keycloak secured with a signed cert from our rootca.
@ebakoba commented on GitHub (Aug 14, 2024):
@christiangierschner and all the future people struggling with OAuth and custom CA certs.
It was able to deduce from the logs that OAuth does not use
requestsas its client module, buthttpxinstead.httpxdocumentation explains that custom CA certs could be used by using environment variableSSL_CERT_FILE. I was able to resolve my cert issue by adding:to docker compose.
@idling-mind commented on GitHub (Feb 6, 2025):
I had similar problem in testing OWUI in an enterprise setting. What ever I tried, I was unable to connect to openai's api end points. This is what finally fixed my issue. If this looks like a useful solution, i'd be happy to create a pull request.
open_webui/routers/openai.pyand added the following in the start.Then where ever I found a
session.getorsession.requestI addedssl=ssl_context.2. set the env variable
SSL_CERT_FILEto/etc/ssl/certs/ca-bundle.crtNow I'm able to connect to openai api endpoints.