Mixed Content: The page at '' was loaded over HTTPS, but requested an insecure resource ''. This request has been blocked; the content must be served over HTTPS.

- 4,555
- 31
- 31
- 45

- 2,233
- 2
- 13
- 14
4 Answers
There's no way to disable mixed content using javascript but you can add this tag
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
to your HTML to allow mixed content

- 4,555
- 31
- 31
- 45

- 2,233
- 2
- 13
- 14
-
This does not appear to have any effect on the current version of Chrome. See my answer below on the Chrome flag. – James Newton Aug 16 '23 at 18:57
to allow Mixed Content:
1- add this meta tag to the page (HTML File)
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
2- add unsafe_url for referrerPolicy to your fetch requests if you get ERR_CONNECTION_REFUSED
example:
fetch('http://URL', {
// ...
referrerPolicy: "unsafe_url"
});
Warning: This policy will leak potentially-private information from HTTPS resource URLs to insecure origins. Carefully consider the impact of this setting.
for more info check these 2 documentations:

- 11
- 3
-
referrerPolicy: "unsafe_url" does not appear to have any effect in Chrome. – James Newton Aug 15 '23 at 22:02
-
Add below to .htaccess
Header add Content-Security-Policy "upgrade-insecure-requests"
This will let the browser try to load HTTP content on the HTTPS page in HTTPS.

- 2,051
- 1
- 19
- 13
-
This answer solved my issue but , can you explain how this happened. Page worked fine for like 1 month and then suddenly this morning this happened – Anel Hodžić Apr 20 '23 at 11:49
-
@AnelHodžić Probably because the browser updated and the new version started enforcing mixed content errors. – James Newton Aug 15 '23 at 22:16
-
In Chrome, you can treat a url as safe via this flag:
chrome://flags/#unsafely-treat-insecure-origin-as-secure
You can enter multiple protocol and urls, even using local IP addresses in a comma delimited list. E.g.
http://192.168.1.142, ws://192.168.1.142
Problems: 1. Requires trust or knowledge on part of the user (browser starts with a warning message about degraded functionality), 2. Chrome specific. 3. Slightly reduces security.

- 698
- 9
- 19