Mixed Content w/ HTTPS #1224

Closed
opened 2025-11-11 14:40:28 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @Fusseldieb on GitHub (Jun 12, 2024).

Since one of the last updates to 3.x, OpenWebUI no longer loads. The DevTools console throws:

Mixed Content: The page at 'https://example.com/' was loaded over HTTPS, but requested an insecure resource 'http://example.com/api/v1/tools/'. This request has been blocked; the content must be served over HTTPS.

TypeError: Failed to fetch
    at window.fetch ...

The fetch function in question makes a request to an API endpoint that has a constant in it which is hardcoded as http:

0917fa6f4a/src/lib/constants.ts (L7)

This causes issues, as the page is trying to load a http resource over a https page, essentially.

A potential solution would be getting the protocol to correctly prepend http or https, depending on the instance. Maybe location.protocol?

Originally created by @Fusseldieb on GitHub (Jun 12, 2024). Since one of the last updates to 3.x, OpenWebUI no longer loads. The DevTools console throws: ``` Mixed Content: The page at 'https://example.com/' was loaded over HTTPS, but requested an insecure resource 'http://example.com/api/v1/tools/'. This request has been blocked; the content must be served over HTTPS. TypeError: Failed to fetch at window.fetch ... ``` The fetch function in question makes a request to an API endpoint that has a constant in it which is hardcoded as **http**: https://github.com/open-webui/open-webui/blob/0917fa6f4ac015810211d85eb41da5d335762952/src/lib/constants.ts#L7 This causes issues, as the page is trying to load a http resource over a https page, essentially. A potential solution would be getting the protocol to correctly prepend http or https, depending on the instance. Maybe `location.protocol`?
Author
Owner

@rbrinson commented on GitHub (Jun 12, 2024):

I just posted about the same issue (https://github.com/open-webui/open-webui/issues/3074). So, me too!

@rbrinson commented on GitHub (Jun 12, 2024): I just posted about the same issue (https://github.com/open-webui/open-webui/issues/3074). So, me too!
Author
Owner

@Altair-Bueno commented on GitHub (Jun 12, 2024):

A potential solution would be getting the protocol to correctly prepend http or https, depending on the instance. Maybe location.protocol?

Indeed, constructing URLs with string templates is always the cause for these annoying bugs. In addition, i would also modify the WEBUI_HOSTNAME constant, as it also assumes we are using the port 8080. Although i would personally remove it...

// WEBUI_HOSTNAME could be removed: https://github.com/search?q=repo%3Aopen-webui%2Fopen-webui%20WEBUI_HOSTNAME&type=code
export const WEBUI_HOSTNAME = browser ? (dev ? location.host : ``) : '';
export const WEBUI_BASE_URL = browser ? (dev ? location.origin : ``) : ``;
@Altair-Bueno commented on GitHub (Jun 12, 2024): > A potential solution would be getting the protocol to correctly prepend http or https, depending on the instance. Maybe location.protocol? Indeed, constructing URLs with string templates is always the cause for these annoying bugs. In addition, i would also modify the `WEBUI_HOSTNAME` constant, as it also assumes we are using the port 8080. Although i would personally remove it... ```js // WEBUI_HOSTNAME could be removed: https://github.com/search?q=repo%3Aopen-webui%2Fopen-webui%20WEBUI_HOSTNAME&type=code export const WEBUI_HOSTNAME = browser ? (dev ? location.host : ``) : ''; export const WEBUI_BASE_URL = browser ? (dev ? location.origin : ``) : ``; ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#1224