0

I have been trying to make HTTPS work on Laravel.

  1. The routes do no longer work when the Laravel application goes on HTTPS.

Expected: the route loads the view.
Result: 404 Not found page.
Note: that this does work without https.

Here is my apache2 conf

<VirtualHost *:80>
    ServerAdmin email@something
    ServerName dev.something

    DocumentRoot /var/www/something/development/public_html
    DirectoryIndex index.php


    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Options -Indexes
    <Directory "/var/www/something/development/public_html/">
            Options FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all

            AuthUserFile /var/www/something/.htpasswd
            AuthName "Password please"
            AuthType Basic
            Require valid-user
    </Directory>

Here is my .htaccess

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

The following code forces laravel5 to go into secure mode.
app/Providers/AppServiceProvider.php

public function boot()
{
    \URL::forceSchema('https');
}
  1. Packages like Barryvdh\Debugbar could no longer load their assets.

I honestly no longer have a clue how I could do this.

If you know something about this please respond!

lorem monkey
  • 3,942
  • 3
  • 35
  • 49
user3410823
  • 65
  • 1
  • 1
  • 7

0 Answers0