I'm using Laravel 5.8
Currently I have this site: sample name
https://www.myssldomain.com/ewallet
and
I have this site: sample name
Using Proxy Pass
included in my myssldomain.com
when the users triggers/search for this link : https://www.myssldomain.com/ewallet/login
the browser will load the content of this site http://my-aws-public-ip/login
The proxy pass
works fine but the problem is the styles
and javascript
is not loaded and the browser says Mixed Content
because the my-aws-public-ip
site is loaded as HTTP not HTTPS
Currently
I changed my config/app.php
as
'url' => env('APP_URL', 'https://www.myssldomain.com/ewallet/'),
and
my
.env
file I changed the APP_URL
to this https://www.myssldomain.com/ewallet/
What I tried
Also
I followed this steps but seems not working too.
https://coderwall.com/p/g9qkea/mixed-content-issue-content-must-be-served-as-https-in-laravel
Also I tried to change the following just to solve the problem
APP_ENV=production
APP_DEBUG=false
APP_URL=https://www.myssldomain.com/ewallet/
and add this code at the beginning of web.php
if (App::environment('production')) {
URL::forceScheme('https');
}
But still not working on my side. Is there anything I need to setup just to make sure this will work?
Expected
Using proxy pass from myssldomain.com
Solved my own problem! Since the proxy uses HTTPS and Laravel uses HTTP Request as default you may try to config it to HTTPS.
Like this
config/app.php
'url' => env('APP_URL', 'https://www.myssldomain.com/ewallet'),
'asset_url' => env('ASSET_URL', 'https://www.myssldomain.com/ewallet'),
.env
APP_NAME=XX
APP_ENV=XXX
APP_KEY=base64:XXX
APP_DEBUG=true
APP_URL=https://www.myssldomain.com/ewallet
app/Providers/AppServiceProvider.php
public function boot()
{
if (env('APP_ENV') !== 'local') {
$this->app['request']->server->set('HTTPS', true);
}
}
routes/web.php
At the beginning of codes add this;
URL::forceRootUrl('https://www.myssldomain.com/ewallet');
After doing this, your CSS/JS will be loaded as HTTPS not HTTP anymore.