Reputation: 1523
Message error:
Mixed Content: The page at 'https://example/contracts/create' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://example:443/api/v1/contracts'. This request has been blocked; the content must be served over HTTPS.
I saw some similar posts, but till now it didn't work.(my .env is with https, and this is not local) I got this error just on this post, the rest of them are with https, and only when I have error validation. On local it's working fine.
Route::middleware('auth:api')->prefix('contracts')->group(function () {
Route::get('{contract?}', 'ContractsController@getContracts');} //in api.php
post("/contracts/" + `${this.customer_id}`, newContract) // in VueJs
Upvotes: 1
Views: 1760
Reputation: 1212
You can add to app\Provider\AppServiceProvider
/**
* Register any application services.
*
* @return void
*/
public function register()
{
if (!app()->isLocal()) {
URL::forceScheme('https');
}
}
Upvotes: 1