Reputation: 156
I tried loading my Laravel L5-swagger URL on heroku, but i get and blank screen. On checking inspect view with chrome i found the error below
https://MY_APP_NAME.herokuapp.com/api/documentation' was loaded over HTTPS, but requested an insecure script 'http://MY_APP_NAME.herokuapp.com/docs/asset/swagger-ui-standalone-preset.js?v=2fb7deffbc136bc6540eb1aa890ca736'. This request has been blocked; the content must be served over HTTPS.
I have set the following env variables on heroku to the apps domain
APP_URL=
L5_SWAGGER_BASE_PATH=
L5_SWAGGER_CONST_HOST=
but no changes still.
NOTE: It works when I open the documentation page over HTTP, but I am looking to make it work over an HTTPS connection. Please any suggestion or advice would be helpful. And is it ok to leave it over an HTTP connection.
Thanks
Upvotes: 3
Views: 5187
Reputation: 99
this is happening because l5-swagger is loading your assets with an absolute path by default, in your config/l5-swagger.php you have this by default :
'use_absolute_path' => env('L5_SWAGGER_USE_ABSOLUTE_PATH', true),
change it to false here or in your env
Upvotes: 1
Reputation: 111
Step 01 : add to .env in producion L5_SWAGGER_GENERATE_ALWAYS = false
or local true
Step 02 : add in AppServiceProvider.php
public function boot()
{
if($this->app->environment('production')) {
URL::forceScheme('https');
}
}
Upvotes: 0