Jump to content

I recently converted my website over to https via cloudflare and I have experienced an error when trying to load my external html header and footer via w3 school's html include. The error is this

Mixed Content: The page at 'https://multicrew.co.uk/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://multicrew.co.uk/indexheader'. This request has been blocked; the content must be served over HTTPS.

And my html include code is this

<!-- Header -->
    <div w3-include-html="indexheader.html"></div>

With this within the tag

<!-- Header/Footer Import Script -->
<script src="https://www.w3schools.com/lib/w3.js"></script>

Thanks

i7-6700k @ 4ghz

GTX1070

16GB Ram

Asus Maximus VIII Hero

500GB SSD

1TB HDD

Link to post
Share on other sites

Your web server itself is still working in HTTP and is directly accessing the indexheader.html file over HTTP.

You get this error because some of the content is loaded over HTTPS, some over HTTP, which is insecure and browsers therefor block it..

 

This is what happens when you use CloudFlare to do the secure part only.

HAL9000: AMD Ryzen 9 3900x | Noctua NH-D15 chromax.black | 32 GB Corsair Vengeance LPX DDR4 3200 MHz | Asus X570 Prime Pro | ASUS TUF 3080 Ti | 1 TB Samsung 970 Evo Plus + 1 TB Crucial MX500 + 6 TB WD RED | Corsair HX1000 | be quiet Pure Base 500DX | LG 34UM95 34" 3440x1440

Hydrogen server: Intel i3-10100 | Cryorig M9i | 64 GB Crucial Ballistix 3200MHz DDR4 | Gigabyte B560M-DS3H | 33 TB of storage | Fractal Design Define R5 | unRAID 6.9.2

Carbon server: Fujitsu PRIMERGY RX100 S7p | Xeon E3-1230 v2 | 16 GB DDR3 ECC | 60 GB Corsair SSD & 250 GB Samsung 850 Pro | Intel i340-T4 | ESXi 6.5.1

Big Mac cluster: 2x Raspberry Pi 2 Model B | 1x Raspberry Pi 3 Model B | 2x Raspberry Pi 3 Model B+

Link to post
Share on other sites

38 minutes ago, HCStrike said:

I recently converted my website over to https via cloudflare and I have experienced an error when trying to load my external html header and footer via w3 school's html include. The error is this

Thanks

Clear your browser cache, or try a different computer. Site loads just fine for me, fully SSL secure, with no mixed content warnings.

Desktop: KiRaShi-Intel-2022 (i5-12600K, 5060 Ti) Mobile: Moto Razr 50 Ultra (Razr+ 2024) | 30GB CAN+US+MEX $30/month
Laptop: Lenovo Yoga 7i (16") 82UF0015US (i7-12700H, 16GB/2TB RAM/SSD, A370M GPU) Tablet: Lenovo Tab Plus (256GB)
Camera: Canon M6 Mark II | Canon Rebel T1i (500D) | Canon SX280 Music: Spotify Premium (CIRCA '08)

Link to post
Share on other sites

10 hours ago, kirashi said:

Clear your browser cache, or try a different computer. Site loads just fine for me, fully SSL secure, with no mixed content warnings.

There is no header or footer...

i7-6700k @ 4ghz

GTX1070

16GB Ram

Asus Maximus VIII Hero

500GB SSD

1TB HDD

Link to post
Share on other sites

11 hours ago, jj9987 said:

Your web server itself is still working in HTTP and is directly accessing the indexheader.html file over HTTP.

You get this error because some of the content is loaded over HTTPS, some over HTTP, which is insecure and browsers therefor block it..

 

This is what happens when you use CloudFlare to do the secure part only.

That is literally just telling me everything I already know...

i7-6700k @ 4ghz

GTX1070

16GB Ram

Asus Maximus VIII Hero

500GB SSD

1TB HDD

Link to post
Share on other sites

1 hour ago, HCStrike said:

There is no header or footer...

I see what you mean now, apologies for not reading the entire post. Have you tried to see if you can do it via jQuery instead? Just for shits and giggles.

https://stackoverflow.com/questions/8988855/include-another-html-file-in-a-html-file

https://www.beyondjava.net/blog/html-includes/

Desktop: KiRaShi-Intel-2022 (i5-12600K, 5060 Ti) Mobile: Moto Razr 50 Ultra (Razr+ 2024) | 30GB CAN+US+MEX $30/month
Laptop: Lenovo Yoga 7i (16") 82UF0015US (i7-12700H, 16GB/2TB RAM/SSD, A370M GPU) Tablet: Lenovo Tab Plus (256GB)
Camera: Canon M6 Mark II | Canon Rebel T1i (500D) | Canon SX280 Music: Spotify Premium (CIRCA '08)

Link to post
Share on other sites

5 hours ago, HCStrike said:

That is literally just telling me everything I already know...

You have two options:

1) Make your web server serve SSL (with or without CloudFlare, up to you). LetsEncrypt provides free certificates for that, if you do not wish to go self-signed route.

2) Reference to the files over full https url.

HAL9000: AMD Ryzen 9 3900x | Noctua NH-D15 chromax.black | 32 GB Corsair Vengeance LPX DDR4 3200 MHz | Asus X570 Prime Pro | ASUS TUF 3080 Ti | 1 TB Samsung 970 Evo Plus + 1 TB Crucial MX500 + 6 TB WD RED | Corsair HX1000 | be quiet Pure Base 500DX | LG 34UM95 34" 3440x1440

Hydrogen server: Intel i3-10100 | Cryorig M9i | 64 GB Crucial Ballistix 3200MHz DDR4 | Gigabyte B560M-DS3H | 33 TB of storage | Fractal Design Define R5 | unRAID 6.9.2

Carbon server: Fujitsu PRIMERGY RX100 S7p | Xeon E3-1230 v2 | 16 GB DDR3 ECC | 60 GB Corsair SSD & 250 GB Samsung 850 Pro | Intel i340-T4 | ESXi 6.5.1

Big Mac cluster: 2x Raspberry Pi 2 Model B | 1x Raspberry Pi 3 Model B | 2x Raspberry Pi 3 Model B+

Link to post
Share on other sites

4 hours ago, jj9987 said:

You have two options:

1) Make your web server serve SSL (with or without CloudFlare, up to you). LetsEncrypt provides free certificates for that, if you do not wish to go self-signed route.

2) Reference to the files over full https url.

For the first option how can I do it with cloudflare, and for the second how would I be able to do that with the w3 include html script?

i7-6700k @ 4ghz

GTX1070

16GB Ram

Asus Maximus VIII Hero

500GB SSD

1TB HDD

Link to post
Share on other sites

On 29/08/2017 at 6:38 PM, HCStrike said:

For the first option how can I do it with cloudflare, and for the second how would I be able to do that with the w3 include html script?

You need to configure the web server on the host. That depends on what web server and what operating system you are running on the hosting machine (meaning, would be great to have these details).

 

If you do the first step, then second won't be necessary. Second step would be using https://[domain]/indexheader.html instead of just indexheader.html

HAL9000: AMD Ryzen 9 3900x | Noctua NH-D15 chromax.black | 32 GB Corsair Vengeance LPX DDR4 3200 MHz | Asus X570 Prime Pro | ASUS TUF 3080 Ti | 1 TB Samsung 970 Evo Plus + 1 TB Crucial MX500 + 6 TB WD RED | Corsair HX1000 | be quiet Pure Base 500DX | LG 34UM95 34" 3440x1440

Hydrogen server: Intel i3-10100 | Cryorig M9i | 64 GB Crucial Ballistix 3200MHz DDR4 | Gigabyte B560M-DS3H | 33 TB of storage | Fractal Design Define R5 | unRAID 6.9.2

Carbon server: Fujitsu PRIMERGY RX100 S7p | Xeon E3-1230 v2 | 16 GB DDR3 ECC | 60 GB Corsair SSD & 250 GB Samsung 850 Pro | Intel i340-T4 | ESXi 6.5.1

Big Mac cluster: 2x Raspberry Pi 2 Model B | 1x Raspberry Pi 3 Model B | 2x Raspberry Pi 3 Model B+

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×