Satyam Pathak
Satyam Pathak

Reputation: 6912

Website works fine with http but not with the https #laravel

I am trying to figure out that why my sub domain website works fine with Http but not when its https. Is there SSL certification problem.

enter image description here

Upvotes: 0

Views: 1530

Answers (2)

Satyam Pathak
Satyam Pathak

Reputation: 6912

The answers given till now are correct but none solved my problem.

The main problem was my application was behind CloudFlare

Laravel detects a Request as secure or insecure by checking a HTTP header i.e.

$_SERVER['REQUEST_SCHEME']

which remains HTTP even the Request is HTTPS due to cloudflare.

CloudFlare sets a different header for the same i.e.

$_SERVER['HTTP_X_FORWARDED_PROTO']

Which must be checked to detect a request is secure or not

Following this article and making some changes to this I successfully managed to generate HTTPS URL without making any changes to previous application code.

Credit Cybersupernova (Stack User )

Upvotes: 0

Mark
Mark

Reputation: 92440

You have a bunch of scripts that are linking with http. Browsers won't run these on a secure page. You need to change the links to https:

<script src="http://bloodsuvidha.vampy.in/js/bootstrap.min.js" type="text/javascript"></script>

This is also true with stylesheets:

<link rel="stylesheet" type="text/css" href="http://bloodsuvidha.vampy.in/css/bootstrap.min.css">

Upvotes: 1

Related Questions