Hi All,
I’m trying to put a big site live and I could use an extra pair of eyes (or brains )
Situation
Live (production) url: https://www.website.com/section/
Server url: https://static.website.com
The https://www.website.com/section/ is a reverse proxy for https://static.website.com
Partial solution
The frontend site works completely as expected, what did I do to make this happen:
1/ passed the ‘index’ and ‘media’ urls with the Kirby instance
$kirby = new Kirby([
'roots' => [
'index' => __DIR__,
'base' => __DIR__,
'site' => "{$rootFolder}/site",
'storage' => "{$storageFolder}",
'content' => "{$storageFolder}/content",
'accounts' => "{$storageFolder}/site/accounts",
'cache' => "{$storageFolder}/site/cache",
'media' => "{$storageFolder}/media",
'sessions' => "{$storageFolder}/site/sessions",
'config' => "{$rootFolder}/site/config"
],
'urls' => [
'index' => $realUrl,
'media' => $realUrl . $media,
],
]);
2/ Overwrite the “url” in my config.php
return [
'url' => fn() => 'https://www.website.com/section',
];
This all works like a charm so all good until there.
Problem 
1 problem though, the panel isn’t working. I just get a blank page. I see simular behaviour like mentioned on Installation and login failing in 3.6 (reverse proxy environments) · Issue #3947 · getkirby/kirby · GitHub.
The panel page has no js errors, everything loads but the screen stays blank.
When I inspect the rendered HTML I see that that the json
const renders 2 url’s
- “$url”: “https://static.website.com” (= wrong)
- “$urls”: {“api”: “https://www.website.com/section/api”, “site”: “https://www.website.com/section”} (= correct)
I’ve tracked down the origin for that $url
to src\Panel\View.php
(line 199) where Url::current()
is being passed and I believe that the Url::current()
is the culprit.
When I, for testing purposes, change the Url::current()
in the View.php
to a hardcoded https://www.website.com/section/panel/
the panel does completely work.
The question
Is there anything more we can do to do overwrite that Url (in a clean way) or is it a bug in Kirby? I’ve been trying to see what goes wrong in the Kirby\Http\Url
but i’m afraid this is above my PHP level