HTTPS assets loading over HTTP - heroku

I'm attempting to load Google Fonts and an image over HTTPS, but they keep loading over HTTP, despite changing the path to "https" in all of the assets.
Mixed Content: The page at 'https://' was loaded over HTTPS, but requested an insecure stylesheet 'http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300italic,300,400italic,500,500italic,700,700italic,900,900italic'. This request has been blocked; the content must be served over HTTPS.
Mixed Content: The page at 'https://' was loaded over HTTPS, but requested an insecure image
'http://farm6.staticflickr.com/5267/5783999789_9d06e5d7df_b.jpg'. This content should also be served over HTTPS.

You can use protocol related url like this:
'//fonts.googleapis.com/css?family=Roboto:400,100,100italic,300italic,300,400italic,500,500italic,700,700italic,900,900italic'.
Also, do not forget to run
rake assets:precompile
before pushing to heroku.

For people who are facing similar troubles using laravel {{HTML::style('css/style.css')}} and {{HTML::script('js/script.js')}} can simply make the HTMLBuilder secure by modifying the statements to
{{HTML::style('css/style.css',array(),true)}} and
{{HTML::script('js/script.js',array(),true)}}
where 'true' insists that the content are severed secure or over HTTPS

Related

Blazor Server hosted on IIS - Mixed content error

I created a Blazor Server API. I am hosting this on IIS on my local PC using HTTPS only with a self generated certificate. It works a treat. I created another Blazor Server API, created another website for it in exactly the same way as I did the first, but when I run the new website I get a mixed-content error. Please don't get bogged down in that, I understand what that means and I have read for about 8 hours on how to fix it. None of the solutions I came across worked.
So, I published my new API to the working website and voila, it works perfectly. This leads me to believe that it is something to do with how I have set up the new site on IIS.
So I deleted the "broken" website via IIS, edited my applicationHost.config, duplicating the original working site, made the appropriate changes and fired up IIS again. Re-published my new API, same problem.
One thing I don't understand is, it fails on a call to 'http://www.mailcontrol.com/http-resources/notification-pages/icons60/error.png', but then displays the image that refers to!!! Not sure if this is a red herring, as it works fine when published to the original website, reinforcing my initial thought that it must be an IIS setup thing.
Here are the things that are failing:
All of which exist on the working API/website
Any help gratefully appreciated.
Edit
Console log as requested:
transactions.oracle.local/:1 Mixed Content: The page at 'https://transactions.oracle.local/' was loaded over HTTPS, but requested an insecure element 'http://www.mailcontrol.com/http-resources/notification-pages/icons60/error.png'. This request was automatically upgraded to HTTPS, For more information see https://blog.chromium.org/2019/10/no-more-mixed-messages-about-https.html
transactions.oracle.local/:1 Mixed Content: The page at 'https://transactions.oracle.local/' was loaded over HTTPS, but requested an insecure element 'http://www.mailcontrol.com/http-resources/notification-pages/2020/notification_page_logo_145x35.png'. This request was automatically upgraded to HTTPS, For more information see https://blog.chromium.org/2019/10/no-more-mixed-messages-about-https.html
Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure stylesheet '<URL>'. This request has been blocked; the content must be served over HTTPS.
Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure stylesheet '<URL>'. This request has been blocked; the content must be served over HTTPS.
Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure stylesheet '<URL>'. This request has been blocked; the content must be served over HTTPS.
Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure stylesheet '<URL>'. This request has been blocked; the content must be served over HTTPS.
Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure stylesheet '<URL>'. This request has been blocked; the content must be served over HTTPS.
Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure stylesheet '<URL>'. This request has been blocked; the content must be served over HTTPS.
transactions.oracle.local/:71 Mixed Content: The page at 'https://transactions.oracle.local/' was loaded over HTTPS, but requested an insecure element 'http://www.mailcontrol.com/http-resources/notification-pages/icons60/error.png'. This request was automatically upgraded to HTTPS, For more information see https://blog.chromium.org/2019/10/no-more-mixed-messages-about-https.html
transactions.oracle.local/:71 Mixed Content: The page at 'https://transactions.oracle.local/' was loaded over HTTPS, but requested an insecure element 'http://www.mailcontrol.com/http-resources/notification-pages/2020/notification_page_logo_145x35.png'. This request was automatically upgraded to HTTPS, For more information see https://blog.chromium.org/2019/10/no-more-mixed-messages-about-https.html
transactions.oracle.local/:1 Mixed Content: The page at 'https://transactions.oracle.local/' was loaded over HTTPS, but requested an insecure script 'http://www.mailcontrol.com/http-resources/notification-pages/empty.js'. This request has been blocked; the content must be served over HTTPS.
(Hangs head in shame) The mixed content issue was a complete red herring. Some idiot made a typo in the hosts file...
Sorry to anyone that wasted their time looking at this non-issue. Valuable lesson for those that follow though..

Disbale HTTPS in asset

I have migrated my laravell 7 sites to a new host site is displaying all data but CSS, JS and Route not working in chrome console it is showing err with Failed to load resource: net::ERR_CONNECTION_REFUSED all URL of assets and routes are using https, how to disable https and use http?
You can use as middleware.
URL::forceScheme('http');
The problem was resolved by commenting below code in htaccess
Header always set Content-Security-Policy: upgrade-insecure-requests

My Vue+Laravel App doesn't want to do Vue on Heroku

I have a Laravel+Vue app that I successfully installed on Heroku and Laravel part works here (https://shoomilka-todoapp.herokuapp.com/), but my Vue code for this application doesn't want to work. Code you can see here https://github.com/shoomilka/todoapp.
Can you help me, please to fix the error of why Vue doesn't work on Heroku?
It works on local environment well.
Try inspect your website and look at the console tab. you will see this error.
Mixed Content: The page at 'https://shoomilka-todoapp.herokuapp.com/'
was loaded over HTTPS, but requested an insecure script
'http://shoomilka-todoapp.herokuapp.com/js/app.js?time=1590194712'.
This request has been blocked; the content must be served over HTTPS.
If your website delivers HTTPS pages, all active mixed content delivered via HTTP on this pages will be blocked by default.
The best strategy to avoid mixed content blocking is to serve all the content as HTTPS instead of HTTP. you can use laravel secure_assets method this generates a URL for an asset using HTTPS
<script src="{{ secure_assets('js/app.js') }}?time={{ time() }}"></script>
or simply just set 'url' => 'https://youDomain.com' in config/app.php and .env APP_URL=https://yourDomain.com

Request blocking

I have an issue on my website.
When I accessed the website by IP everything is good but when I access the website by domain name I got this error:
Mixed Content: The page at `<URL>` was loaded over HTTPS, but
requested an insecure stylesheet `<URL>`. This request has been
blocked; the content must be served over HTTPS.
https://141.105.67.4/en/games
https://g11games.com/en/games
Can you please help to solve this issue.
As the error states, you website is being loaded via https, but the scripts contained within the website, are being loaded via http. Likely, in your config, you have set APP_URL to point the http URL, so all assets on your website are using that as the base URL. Changing that to HTTPS should resolve the errors.
fixed by adding
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

Prestashop and https

I have problem with https. In console I have
Mixed Content: The page at 'https://home.pl/pl/' was loaded over HTTPS, but requested an insecure image 'http://home.pl/img/cms/home.png'. This content should also be served over HTTPS.
The console "shows" the solution. You should serve the home.png with https, so the correct url should be https://home.pl/img/cms/home.png
In the .tpl use this snippet to check if is active the SSL mode in backoffice.
For example.
For the link:
My link
For images:
<image src="http{if Tools::usingSecureMode()}s{/if}://home.pl/img/cms/home.png">

Resources