Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

devionti's avatar

chartjs won't load over HTTPS

How can I force chartjs to work over HTTPS So Chartjs loads fine when I am using a model if I use HTTP, if I use HTTPS I get this error This request has been blocked; the content must be served over HTTPS. This is the code I am using that only works on HTTP but not HTTPS

(new StackedChart())
            ->title('Totalbeds')
            ->model('\App\Model\Hotel\Room') // Use Your Model Here
            ->series(array([
                'label' => 'Location 1',
                'filter' => [
                    'key' => 'id', // State Column for Count Calculation Here
                    'value' => '1'
            ],
            ]
            ))
            ->options([
                'sum' => 'totalbeds' // Add the column you want to calculate
            ])
            ->width('2/3'),

I am unsure how can I force chartjs to use HTTPS, forceSchema won't work because chartjs is not available in routes since I am using NOVA.

if (env('APP_ENV') === 'production') {
    URL::forceSchema('https');
}

https://coroo.github.io/nova-chartjs/#/

0 likes
3 replies
bobbybouwmann's avatar

@devionti The problem is that you force HTTPS only your website. The browser now expects that all requests go for HTTPS. This also counts for CSS or JS resources you try to include. In your developer console in the browser you can see what resource/URL is causing this.

2 likes
devionti's avatar

I just installed a fresh installation of nova and added the chart to count how many users that's it,

the issue is

Mixed Content: The page at 'https://mywebsite.com/nova/resources/users' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://mywebsite.com/coroowicaksono/check-data/circle-endpoint?model=%5CApp%5CUser&series[]=%7B%22label%22:%22users%22,%22filter%22:%7B%22key%22:%22id%22,%22value%22:%221%22%7D%7D&options=%7B%22count%22:%22id%22%7D&expires=0'. This request has been blocked; the content must be served over HTTPS.

This is the vendor/coroowikasono/route/api.php

<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Card API Routes
|--------------------------------------------------------------------------
|
| Here is where you may register API routes for your card. These routes
| are loaded by the ServiceProvider of your card. You're free to add
| as many additional routes to this file as your card may require.
|
*/
Route::get('/endpoint', \Coroowicaksono\ChartJsIntegration\Api\TotalRecordsController::class . '@handle');
Route::get('/circle-endpoint', \Coroowicaksono\ChartJsIntegration\Api\TotalCircleController::class . '@handle');

The developer says it should work fine and I did test it locally using valet secure and it worked fine. So I am currently talking to cloudways to see if they can figure out the issue on their end.

sox's avatar

Hi, did you win with this issue? I'm experiencing the same but hosted on Azure Web Apps

Please or to participate in this conversation.