0

I have implemented SSL in dev, test and prod environments. I had to change some blade function to secure_asset() and secure_url for preventing Chrome to block content. But know I have many issues in my local environment due to the changes I explained before.

Which is the way to work with SSL on server environments but not in local?

Regards

2 Answers 2

6

Add the follwing snipped to the register() method of one of your service providers and use the asset() helper instead of the secure_asset(). This way URLs will be forced to have the https scheme on environments which are not local but local environments will keep working with the unsecure http scheme.

public function register() { if (config('app.env') !== 'local') { \URL::forceScheme('https'); } } 
Sign up to request clarification or add additional context in comments.

Comments

1
function generate_asset_url($string) { if (in_array(env('APP_ENV'), ['local', 'dev'])) { return asset($string); } return secure_asset($string); } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.