2
votes

Mixed Content: The page at 'https://api.xyz.com/api/documentation' was loaded over HTTPS,

but requested an insecure stylesheet 'http://api.xyz.com/swagger-ui-assets/swagger-ui.css?v=26ec363936a21921c9fec290e551e3eb'.

This request has been blocked; the content must be served over HTTPS.

I know how to solve this problem in Laravel but unable to solve this in case of Lumen.

Tried Solutions:

  1. Added below line in AppServiceProvider

    URL::forceSchema('https');  
    
2
try removing the http from the stylesheet's url and jut leave a single /Muhammad
How are you loading the stylesheet ?Mike
@Mike I am using Swagger for API documentation. and it is working fine over HTTP but over HTTPS it is not working.Radhe Shyam sharma
Did you manage to solve this @RadheShyamsharma? Still getting problems with this.Alexander Arce

2 Answers

0
votes

Check the APP_URL in the .env file which is set to http://localhost

Heroku uses https://appname.herokuapp.com since it's in production but lumen uses http://localhost for dev mode so I fixed it by running heroku config:set APP_URL=https://localhost

0
votes

update boot() method in app/Providers/AppServiceProvider.php file as bellow

public function boot()
{
    if(env('APP_ENV') !== 'local') {
       URL::forceScheme('https');
    }
}

alse update APP_ENV to APP_ENV=prod in .evn file