Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions config/laravels.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@

'laravel_base_path' => env('LARAVEL_BASE_PATH', base_path()),

/*
|--------------------------------------------------------------------------
| HTTP Force SSL
|--------------------------------------------------------------------------
|
| With this set, Swoole Server will place the header "Scheme", used by
| laravel to define routes through the application. This is important if
| you are using Swoole alone (not using nginx/apache proxy).
|
*/
'http_force_ssl' => env('LARAVELS_HTTP_FORCE_SSL', false),

/*
|--------------------------------------------------------------------------
| Inotify Reload
Expand Down
8 changes: 8 additions & 0 deletions src/Swoole/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ public function toIlluminateRequest(array $rawServer = [], array $rawEnv = [])
}
}
$server = array_change_key_case($server, CASE_UPPER);

if (
config('laravels.http_force_ssl', false)
&& !isset($server['REQUEST_SCHEME'])
) {
$server['REQUEST_SCHEME'] = 'https';
}

$_SERVER = array_merge($_SERVER, $server);
if (isset($_SERVER['REQUEST_SCHEME']) && $_SERVER['REQUEST_SCHEME'] === 'https') {
$_SERVER['HTTPS'] = 'on';
Expand Down