Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic redirect to HTTPS #1032

Closed
wants to merge 2 commits into from
Closed
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
11 changes: 11 additions & 0 deletions login.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

// Force HTTPS redirection if accessed over HTTP or forwarded from HTTP
if (
(!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on') &&
(!isset($_SERVER['HTTP_X_FORWARDED_PROTO']) || $_SERVER['HTTP_X_FORWARDED_PROTO'] !== 'https')
) {
$https_url = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header("Location: $https_url");
exit;
}


// Enforce a Content Security Policy for security against cross-site scripting
header("Content-Security-Policy: default-src 'self' fonts.googleapis.com fonts.gstatic.com");

Expand Down
11 changes: 10 additions & 1 deletion portal/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
/*
* Client Portal
* Landing / Home page for the client portal
*/

*/// Force HTTPS redirection if accessed over HTTP or forwarded from HTTP
if (
(!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on') &&
(!isset($_SERVER['HTTP_X_FORWARDED_PROTO']) || $_SERVER['HTTP_X_FORWARDED_PROTO'] !== 'https')
) {
$https_url = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header("Location: $https_url");
exit;
}

header("Content-Security-Policy: default-src 'self' fonts.googleapis.com fonts.gstatic.com");

Expand Down