Context
My Kirby instance runs in a Docker instance (exposing port 8080), which sits behind a load balancer that exposes ports 80/443 and forwards all traffic to 8080. (My dev localhost setup does port forwarding as well, to simulate this setup.)
As far as Kirby is concerned, it’s running on port 8080. By default, this causes it to break all absolute urls, because it they’re in the form of example.com:8080/foo/bar
. To mitigate this, I custom the index root in my site.php
like this:
$kirby->urls->index = url::scheme() . '://' . $_SERVER['SERVER_NAME'];
In this case, $_SERVER['SERVER_NAME']
would be the equivalent of www.example.com
so this all works out.
This has worked incredibly well for everything related to Kirby and Kirby Panel, except for one issue now.
Issue
It seems like Pagination doesn’t respect this custom index URL and will include the unwanted port number. Our site doesn’t currently have any paginated pages, so I’m not sure if normal pagination is affected, but Pagination in the Panel definitely is.
For example, here is subpage pagination html from the sidebar, but the issue occurs when re-ordering subpages (in the full screen experience).
<nav class="pagination cf">
<a class="pagination-prev pagination-inactive" href="http://localhost:8080/panel/pages/black-friday/deals/edit?page=1"><i class="icon fa fa-chevron-left"></i></a>
<span class="pagination-index">
1 / 3 <select onchange="app.content.open(this.value)">
<option value="http://localhost:8080/panel/pages/black-friday/deals/edit?page=1" selected="">1</option>
<option value="http://localhost:8080/panel/pages/black-friday/deals/edit?page=2">2</option>
<option value="http://localhost:8080/panel/pages/black-friday/deals/edit?page=3">3</option>
</select>
</span>
<a class="pagination-next" href="http://localhost:8080/panel/pages/black-friday/deals/edit?page=2"><i class="icon fa fa-chevron-right"></i></a>
</nav>