king_eke
9 months ago
133
3
Laravel

Axios Mixed Content

Posted 9 months ago by king_eke

I'm trying to get a post request from my server to the client dashboard, but keep getting this response

Mixed Content: The page at 'https://yallaexpress.herokuapp.com/dashboard' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://yallaexpress.herokuapp.com/undefined/dashboard/delivery-data'. This request has been blocked; the content must be served over HTTPS.
 axios.post('/dashboard/delivery-data/', {
            headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
            'Accept': 'application/json'
            }
          }).then(function (response) {
            setDeliveries(response.data);
        });

In my local environment it works fine, but in my heroku environment it doesn't, but works on the admin dashboard

the route

Route::post('/delivery-data', ['uses' => '[email protected]']);

the controller

$client = $this->client;

        $deliveries = DeliveryStatus::latest()->whereHas('delivery', function($q)use($client){
            $q->where('client_id', $client->id);
        })->select('status', 'created_at')->get()->groupBy(function ($date){
            return Carbon::parse($date->created_at)->format('Y');
        })->toArray();

        return response()->json($deliveries, 200);

Please sign in or create an account to participate in this conversation.