summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfreya <Freya Murphy>2024-09-25 16:18:23 +0000
committerfreya <Freya Murphy>2024-09-25 16:18:23 +0000
commit6702a8586c8cc0fdb8b28c835841e44b2b5663be (patch)
tree6755cdc01cdf782c629ec4fec49db86df80cc2d8 /src
parentfix blog post grammer (diff)
downloadwebsite-6702a8586c8cc0fdb8b28c835841e44b2b5663be.tar.gz
website-6702a8586c8cc0fdb8b28c835841e44b2b5663be.tar.bz2
website-6702a8586c8cc0fdb8b28c835841e44b2b5663be.zip
give https urls if in a https context
Diffstat (limited to 'src')
-rw-r--r--src/web/core/core.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/web/core/core.php b/src/web/core/core.php
index cfeeea9..3b23410 100644
--- a/src/web/core/core.php
+++ b/src/web/core/core.php
@@ -36,13 +36,17 @@ abstract class Core {
*/
public static function get_url(string $path, bool $timestamp = FALSE): string
{
+ $scheme = 'http';
+ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']))
+ $scheme = $_SERVER['HTTP_X_FORWARDED_PROTO'];
+
$host = $_SERVER['HTTP_HOST'];
if (ENVIRONMENT == 'production')
$host = lang('domain');
$base = lang('base_path');
- $url = "http://{$host}{$base}{$path}";
+ $url = "{$scheme}://{$host}{$base}{$path}";
if ($timestamp) {
$time = @filemtime(PHP_ROOT . '/' . $path);
$url .= "?timestamp={$time}";