I haven't reproduced on a test instance because I don't think I can get full admin access, but I reproduced and root caused on my local setup, so hopefully this is helpful. Here goes:
- Set up uri.allowed-protocols to be something super simple like {"myprotocol", true}. Omit standard ones
- Do not set up alternate file domain, such that your files are served from the same domain as the rest of your content
- Enable HTTPS for everything and automatically redirect to HTTPS
- Navigate to a file in your repository and click "View Raw File"
At this point you'll get an error that says:
Refusing to redirect to external URI "https://phabricator.example.com/<a bunch of stuff here>". This URI is not a valid remote web resource.'
I did some digging and it looks like PhabricatorEnv::requireValidRemoteURIForLink checks for a presence of protocol, and makes sure that the protocol specifies is included in uri.allowed-protocols. Since HTTPS is not on the list, the check fails.
Adding HTTPS to the list of allowed URI works around the problem, but it seems like the right solution here is really:
- Check fully-qualified links against the base URI
- Assume HTTP and HTTPS are allowed by default, even if they are not explicitly specified in uri.allowed-protocols