Reputation: 790
Im not sure if my question is valid, I have a laravel app, by default I can access it using http protocol,
but due to security reasons, I was instructed to use https instead, So I was planning to configure my apache and use the default-ssl.conf,
but before I do that, I want to know if changing it to https will it affect my routes?
Upvotes: 1
Views: 471
Reputation: 15961
if you want to use mixed routes in your application you can use some laravel built-in helper methods.
use secure_asset()
and url('url',params, true)
the last param in url()
is for securing route.
EDIT 1
there is also another function secure_url
for securing url. If your application is using mixed routes.
Hope this helps.
Thanks
Upvotes: 0
Reputation: 1979
Normal SSH and Cpanel
If you are using normal ssh provided by server providers then do not worry, You just need to change in your environment file.
which is placed in project_root/.env where you can change your APP_URL from http:// to https://
Also you can directly change in config/app.php in 'url' parameter.
cloudflare
Answer of Mathieu Ferre is correct
Upvotes: 0
Reputation: 4412
It MAY affect your routes !
If you are using cloudflare for your ssl certificate, Laravel will not recognise it as a secure url, You will have to specify in your code that you want a secure url
for example for your assets, you may have to use
secure_asset('img/photo.jpg')
Upvotes: 0
Reputation: 163848
No, it will not affect your routes.
To make all helpers like route()
, url()
, action()
etc generate HTTPS links change http
to https
in the .env
file:
APP_URL=https://some.app
Upvotes: 5