Skip to content

Commit 542afad

Browse files
committed
Fixed HTTPS links on reverse proxies
The force HTTPS option in the config now turns any link into HTTPS. This also works on reverse proxy setups. The previous option in the config is now being replaced with the new option FORCE_ROUTE_HTTPS which redirects all routes and pages to HTTPS. This option should never be used behind a reverse proxy. See issue: #216
1 parent ac77efe commit 542afad

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,6 @@ ENABLE_SOCIAL_LOGIN=false
9595

9696
#Sets if a plain PNG or iframe should be used for the theme preview image
9797
USE_THEME_PREVIEW_IFRAME=true
98+
99+
#Redirects all pages to https
100+
FORCE_ROUTE_HTTPS=false

resources/views/layouts/lang.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@if(env('FORCE_HTTPS') == 'true')<?php URL::forceScheme('https'); ?>@endif
12
@if(env('CUSTOM_META_TAGS') == 'true' and config('advanced-config.lang') != '')
23
<html lang="{{ config('advanced-config.lang') }}">
34
@else
@@ -6,7 +7,7 @@
67

78

89
{{-- Redirects to https if enabled in the advanced-config --}}
9-
@if(env('FORCE_HTTPS') == 'true')
10+
@if(env('FORCE_ROUTE_HTTPS') == 'true')
1011
@php
1112
if (! isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == 'off' ) {
1213
$redirect_url = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

routes/web.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
Route::group([
7474
'middleware' => env('REGISTER_AUTH'),
7575
], function () {
76-
if(env('FORCE_HTTPS') == 'true'){URL::forceScheme('https');}
76+
if(env('FORCE_ROUTE_HTTPS') == 'true'){URL::forceScheme('https');}
7777
if(isset($_COOKIE['LinkCount'])){if($_COOKIE['LinkCount'] == '20'){$LinkPage = 'showLinks20';}elseif($_COOKIE['LinkCount'] == '30'){$LinkPage = 'showLinks30';}elseif($_COOKIE['LinkCount'] == 'all'){$LinkPage = 'showLinksAll';} else {$LinkPage = 'showLinks';}} else {$LinkPage = 'showLinks';} //Shows correct link number
7878
Route::get('/studio/index', [UserController::class, 'index'])->name('studioIndex');
7979
Route::get('/studio/add-link', [UserController::class, 'AddUpdateLink'])->name('showButtons');
@@ -112,7 +112,7 @@
112112
Route::group([
113113
'middleware' => 'admin',
114114
], function () {
115-
if(env('FORCE_HTTPS') == 'true'){URL::forceScheme('https');}
115+
if(env('FORCE_ROUTE_HTTPS') == 'true'){URL::forceScheme('https');}
116116
Route::get('/panel/index', [AdminController::class, 'index'])->name('panelIndex');
117117
Route::get('/panel/users/{type}', [AdminController::class, 'users'])->name('showUsers');
118118
Route::post('/panel/users/{name?}', [AdminController::class, 'searchUser'])->name('searchUser');

storage/backups/default_settings

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,7 @@ ENABLE_THEME_UPDATER=true
9494
ENABLE_SOCIAL_LOGIN=false
9595

9696
#Sets if a plain PNG or iframe should be used for the theme preview image
97-
USE_THEME_PREVIEW_IFRAME=true
97+
USE_THEME_PREVIEW_IFRAME=true
98+
99+
#Redirects all pages to https
100+
FORCE_ROUTE_HTTPS=false

0 commit comments

Comments
 (0)