This is the issue I'm experiencing.
https://github.com/modxcms/revolution/issues/6034
Since I've been auditing the site and removing inline scheme directives I've noticed that it is primarily when building with [[~1]] with no inline scheme that is causing issues.
Turns out MODX doesn't support relative site root URLs when using -1 unless you double up and write in the scheme inline (~1? &scheme=`-1`). This is due to what I personally feel to be a bug in the code, described below.
That means that any instance of [[~1]] is built as an absolute URL and cached by the first person to visit, with the protocol they happened to use.
Looking at the code this honestly does look like a bug, because someone has assumed -1 would always be INT in multiple places. Both in the site_start check AND in the later host building block with the switch too (good job the switch doesn't have a default). The absolute URL that results seems to be a side effect of an empty url var. Why would you test for -1 but not '-1' if this was a purposeful effect? And why not just fix this instead of making jokes on the ticket?
The issue is obvious if you look in modcontext.class.php
((integer) $id === (integer) $config['site_start']) {
As it doesn't handle STRINGS, only integer instances of the -1 arg. All that needs to be done is a STRING equivalent test for '-1' performed alongside each integer test. None of the later code does anything to links with the -1 scheme, it just prepends an empty host string.
It is easier to just set the global setting to 'abs' to get around this on a basic site, but that does not excuse the bug.
[ed. note: johnnyp last edited this post 7 years, 1 month ago.]