apache handler: allow users to override the port/scheme for redirections
By default, LLNG tries to detect the port and scheme of the incoming request to build the url= parameter (see _buildUrl
)
However, if we are behind a reverse proxy, the SERVER_PORT and HTTPS variables are incorrect. Imagine
USER --https://test1.example.com--> RP ---http://internal:999--> LLNG
The redirect URL will be http://test1.example.com:999
A solution can be to force Port and Https in the vhost config BUT this prevents having vhosts that can be accessed BOTH over HTTP and HTTPS.
This is easily solved in Nginx:
# HTTPS vhost
fastcgi_param HTTPS On;
fastcgi_param SERVER_PORT 443
...
#HTTP vhost
fastcgi_param HTTPS off;
fastcgi_param SERVER_PORT 80
But there is no such workaround for Apache yet.
Possible fixes
Read an override from ENV in the Apache vhost before falling back to $r->get_server_port
I also need to fix the current code to read $req->scheme instead of $req->env->{HTTPS} in _isHttps
.