Hello! Long story short, I had to make a quick modification to index.php so LINEAGEOTA_BASE_PATH could reach the API server, and i'm not sure if it's my apache configuration or something else:
When I first set the deployment up a few months ago, I needed to define env variable LINEAGEOTA_BASE_PATH for my reverse proxy, and updated to latest commit (latest tagged release that composer grabs is 2.9.0 without the change for $base_path).
I declared the variable in /etc/apache2/envvars as LINEAGEOTA_BASE_PATH=https://externalURL
, however the server does not seem to see the variable, the API call would return "url":"http:\/\/internalURL:port\"
. Tried defining it in .htaccess as well, no dice.
I can confirm the variables in envvars were being set by viewing phpinfo() under Apache Environment:
SCRIPT_FILENAME | /var/www/LineageOTA/phpinfo.php
LINEAGEOTA_BASE_PATH | https://externalURL
HTTP_HOST | internalURL:port
index.php follows else here, but phpinfo() could resolve the variable.
if ( isset($_ENV['LINEAGEOTA_BASE_PATH']) )
$base_path = $_ENV['LINEAGEOTA_BASE_PATH'];
else
$base_path = $protocol.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']);
After a bit of trial and error, I ended up modifying the file, changing:
$_ENV
to $_SERVER
if ( isset($_SERVER['LINEAGEOTA_BASE_PATH']) )
$base_path = $_SERVER['LINEAGEOTA_BASE_PATH'];
This allowed me to define the variable in /etc/apache2/sites-enabled/LineageOTA.conf with SetEnv LINEAGEOTA_BASE_PATH https://externalURL
, where it is successfully read by the API server ("url":"https:\/\/externalURL\"
), and downloads are able to commence on my phone with the corresponding prop.
I'd forgotten about this modification until I decided to redeploy the api server into my main Jenkins container, sure enough the same issue became visible again, and I made the same change to allow the variable to reach the server after troubleshooting Apache. Am I missing something in Apache2 regarding environment variables? Anyone had a similar experience/solution?