fixes
This commit is contained in:
@ -25,7 +25,7 @@ $domain = $_ENV['MAIN_COOKIE_DOMAIN'] ?? '.lxdapp.local';
|
|||||||
session_set_cookie_params([
|
session_set_cookie_params([
|
||||||
'lifetime' => 0,
|
'lifetime' => 0,
|
||||||
'path' => '/',
|
'path' => '/',
|
||||||
'domain' => $domain,
|
// 'domain' => $domain,
|
||||||
'secure' => false, // set true if using HTTPS
|
'secure' => false, // set true if using HTTPS
|
||||||
'httponly' => true,
|
'httponly' => true,
|
||||||
'samesite' => 'Lax',
|
'samesite' => 'Lax',
|
||||||
|
|||||||
@ -108,7 +108,7 @@ class LoginController
|
|||||||
|
|
||||||
$ip = $lxd->getContainerIP($name);
|
$ip = $lxd->getContainerIP($name);
|
||||||
$nginx = $lxd->getContainerServiceStatus($name, 'nginx');
|
$nginx = $lxd->getContainerServiceStatus($name, 'nginx');
|
||||||
$mysql = $lxd->getContainerServiceStatus($name, 'mysql');
|
$mysql = $lxd->getContainerServiceStatus($name, 'mariadb');
|
||||||
|
|
||||||
if ($ip && $nginx === 'active' && $mysql === 'active') {
|
if ($ip && $nginx === 'active' && $mysql === 'active') {
|
||||||
// ---- CHANGED: do NOT return fields/creds here ----
|
// ---- CHANGED: do NOT return fields/creds here ----
|
||||||
|
|||||||
@ -36,6 +36,7 @@ class LxdService
|
|||||||
curl_setopt($ch, CURLOPT_SSLCERT, $clientCert);
|
curl_setopt($ch, CURLOPT_SSLCERT, $clientCert);
|
||||||
curl_setopt($ch, CURLOPT_SSLKEY, $clientKey);
|
curl_setopt($ch, CURLOPT_SSLKEY, $clientKey);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
||||||
|
|
||||||
@ -84,6 +85,7 @@ class LxdService
|
|||||||
curl_setopt($ch, CURLOPT_SSLCERT, $clientCert);
|
curl_setopt($ch, CURLOPT_SSLCERT, $clientCert);
|
||||||
curl_setopt($ch, CURLOPT_SSLKEY, $clientKey);
|
curl_setopt($ch, CURLOPT_SSLKEY, $clientKey);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
||||||
|
|
||||||
|
|||||||
10
index.php
10
index.php
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// === Handle API requests ===
|
// === Handle API requests ===
|
||||||
$requestUri = $_SERVER['REQUEST_URI'];
|
$requestUri = $_SERVER['REQUEST_URI'];
|
||||||
if (str_starts_with($requestUri, '/api/')) {
|
if (str_starts_with($requestUri, '/api/')) {
|
||||||
@ -43,15 +42,16 @@ if ($state !== 'Running') {
|
|||||||
|
|
||||||
// === Get container IP ===
|
// === Get container IP ===
|
||||||
$ip = $lxd->getContainerIP($container);
|
$ip = $lxd->getContainerIP($container);
|
||||||
|
|
||||||
$nginx = $lxd->getContainerServiceStatus($container, 'nginx');
|
$nginx = $lxd->getContainerServiceStatus($container, 'nginx');
|
||||||
$mysql = $lxd->getContainerServiceStatus($container, 'mysql');
|
$mysql = $lxd->getContainerServiceStatus($container, 'mariadb');
|
||||||
|
|
||||||
if (!$ip || $nginx !== 'active' || $mysql !== 'active') {
|
if (!$ip || $nginx !== 'active' || $mysql !== 'active') {
|
||||||
redirect($waitingPage);
|
redirect($waitingPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// === Proxy to container ===
|
// === Proxy to container ===
|
||||||
proxy($container, "http://{$ip}{$requestUri}");
|
proxy($container, "http://{$host}{$requestUri}");
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
|
||||||
@ -63,11 +63,9 @@ function redirect(string $to): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function proxy(string $name, string $targetUrl): void {
|
function proxy(string $name, string $targetUrl): void {
|
||||||
Proxy::$AUTH_KEY = $_ENV['AUTH_KEY'] ?? 'YOUR_DEFAULT_AUTH_KEY';
|
Proxy::$ENABLE_AUTH = false;
|
||||||
Proxy::$ENABLE_AUTH = true;
|
|
||||||
Proxy::$HEADER_HTTP_PROXY_AUTH = 'HTTP_PROXY_AUTH';
|
Proxy::$HEADER_HTTP_PROXY_AUTH = 'HTTP_PROXY_AUTH';
|
||||||
|
|
||||||
$_SERVER['HTTP_PROXY_AUTH'] = Proxy::$AUTH_KEY;
|
|
||||||
$_SERVER['HTTP_PROXY_TARGET_URL'] = $targetUrl;
|
$_SERVER['HTTP_PROXY_TARGET_URL'] = $targetUrl;
|
||||||
|
|
||||||
$responseCode = Proxy::run();
|
$responseCode = Proxy::run();
|
||||||
|
|||||||
Reference in New Issue
Block a user