Get the approot by analyzing the request. This is not a full-proof
approach, but in many common cases will work. Situations that can break this
are:
Requests which spoof headers and imply the connection is over HTTPS
Reverse proxies that change ports in surprising ways
Invalid Host headers
Reverse proxies which modify the path info
Normally trusting headers in this way is insecure, however in the case of
approot, the worst that can happen is that the client will get an incorrect
URL. If you are relying on the approot for some security-sensitive purpose,
it is highly recommended to use hardcoded, which cannot be spoofed.
Since 3.0.7