zenhack / ttrss-sandstorm

Sandstorm port of Tiny Tiny RSS
GNU General Public License v3.0
6 stars 2 forks source link

Mobile clients getting 500 errors #21

Closed ocdtrekkie closed 3 years ago

ocdtrekkie commented 3 years ago

This is in my grain log, it leaves nothing in TTRSS's System Log:

2021/01/10 18:58:44 [error] 82#82: *253 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function is_server_https() in /opt/app/config.php:22
Stack trace:
#0 /opt/app/api/index.php(4): require_once()
#1 {main}
  thrown in /opt/app/config.php on line 22" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /api/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "sandbox"
2021/01/10 18:58:46 [error] 82#82: *255 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function is_server_https() in /opt/app/config.php:22
Stack trace:
#0 /opt/app/api/index.php(4): require_once()
#1 {main}
  thrown in /opt/app/config.php on line 22" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /api/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "sandbox"
2021/01/10 18:58:48 [error] 82#82: *257 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function is_server_https() in /opt/app/config.php:22
Stack trace:
#0 /opt/app/api/index.php(4): require_once()
#1 {main}
  thrown in /opt/app/config.php on line 22" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /api/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "sandbox"
2021/01/10 18:59:02 [error] 82#82: *259 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function is_server_https() in /opt/app/config.php:22
Stack trace:
#0 /opt/app/api/index.php(4): require_once()
#1 {main}
  thrown in /opt/app/config.php on line 22" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /api/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "sandbox"
** SANDSTORM SUPERVISOR: Grain still in use; staying up for now.
2021/01/10 18:59:23 [error] 82#82: *261 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function is_server_https() in /opt/app/config.php:22
Stack trace:
#0 /opt/app/api/index.php(4): require_once()
#1 {main}
  thrown in /opt/app/config.php on line 22" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /api/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "sandbox"
2021/01/10 18:59:24 [error] 82#82: *263 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function is_server_https() in /opt/app/config.php:22
Stack trace:
#0 /opt/app/api/index.php(4): require_once()
#1 {main}
  thrown in /opt/app/config.php on line 22" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /api/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "sandbox"
2021/01/10 18:59:25 [error] 82#82: *265 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function is_server_https() in /opt/app/config.php:22
Stack trace:
#0 /opt/app/api/index.php(4): require_once()
#1 {main}
  thrown in /opt/app/config.php on line 22" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /api/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "sandbox"
2021/01/10 18:59:29 Reading from websocket: websocket: close 1006 (abnormal closure): unexpected EOF
2021/01/10 18:59:29 ceasing to receive pb messages
2021/01/10 18:59:29 Connection #2 closed
2021/01/10 18:59:30 Called Connect()
2021/01/10 18:59:30 New connection (#3)
2021/01/10 18:59:30 Receiving pb messages.
2021/01/10 18:59:36 [error] 82#82: *271 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function is_server_https() in /opt/app/config.php:22
Stack trace:
#0 /opt/app/api/index.php(4): require_once()
#1 {main}
  thrown in /opt/app/config.php on line 22" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /api/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "sandbox"
2021/01/10 18:59:38 [error] 82#82: *273 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function is_server_https() in /opt/app/config.php:22
Stack trace:
#0 /opt/app/api/index.php(4): require_once()
#1 {main}
  thrown in /opt/app/config.php on line 22" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /api/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "sandbox"
2021/01/10 18:59:39 [error] 82#82: *275 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function is_server_https() in /opt/app/config.php:22
Stack trace:
#0 /opt/app/api/index.php(4): require_once()
#1 {main}
  thrown in /opt/app/config.php on line 22" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /api/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "sandbox"
ocdtrekkie commented 3 years ago

Guessing this is the offending commit: https://github.com/zenhack/ttrss-sandstorm/commit/74568df4ff7b7788991636f6fb2ed62012f85c3b since is_server_https() lives in functions.php which you call here: https://github.com/zenhack/ttrss-sandstorm/blob/master/.sandstorm/rootfs/opt/app/config.php

ocdtrekkie commented 3 years ago

If we want to avoid re-adding a bunch of stuff to the global context... I kinda wonder if the config.php hack in place now could be replaced with part of the original function, which isn't really that long...

function is_server_https() {
        return (!empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] != 'off')) || $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https';
    }
zenhack commented 3 years ago

Yeah, I'd pinned that down; I'll probably just copy the function into config.php, which should be more robust to changes in the future.