4

I am working on Laravel version 5.5. I have one application that needs domain to execute. That's why, I added following entries in my /etc/hosts file so that I can open my application using domains like dashboard.application.dev or api.application.dev. Here is how my /etc/hosts file looks like.

127.0.0.1 localhost 127.0.1.1 p01ymath 127.0.0.1 dashboard.application.dev 127.0.0.1 api.application.dev 

I am serving my application using php artisan serve --port=80 so that I can execute my application using plain development domain names. Yes, have turned off apache,nginx or any other server that runs on the port 80.

The issue is, when I try to open dashboard.application.dev or api.application.dev, It is getting redirected to https version of the application. I have cleared cache using php artisan cache:clear and composer dump-autoload and php artisan route:clear and php artisan optimize but nothing works.

Here is how my AppServiceProvider looks like. It says that if the application is not on the local environment, redirect to https version.

public function boot() { if (!App::environment('local')) { URL::forceScheme('https'); } } 

But my application is in local environment. My APP_ENV directive in .env file is set to local which means the application must not redirect me to https version. I even tried to clean cache on my browser and tried to open the application in another browser that I never use. Still, the issue remains unsolved.

Is there anything I am doing wrong?

2
  • Is there anything in the .htaccess that could induce that behaviour? if on that boot function, you do dd(App::environment('local')) what does it output? Commented Mar 27, 2018 at 8:53
  • What browser? I've read Chrome is going to do that automatically for all .dev domains. Commented Mar 27, 2018 at 8:53

2 Answers 2

7

Chrome 63 (out since December 2017), will force all domains ending on .dev (and .foo) to be redirected to HTTPS via a preloaded HTTP Strict Transport Security (HSTS) header. You can find more information about this here.

Change domain to .local or .test

Sign up to request clarification or add additional context in comments.

1 Comment

yes. I changed my domains to .test and they are working perfectly!
2

Maybe you have this line in your app.blade

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> 

IF so,remove it.

1 Comment

U just save my ass bruh wth, Im debugging whole day with LLMS. I forgot that i added this line of code upon tunneling my app to cloudflare. Thanks a lot

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.