Closed neildaniels closed 5 years ago
I cannot reproduce this. What do you see when you open the panel with the custom URL and check out the source code. Pretty close to the end you should see something like this:
<script>window.panel = {"url":"http://sandbox.test/panel","site":"http://sandbox.test","api":"http://sandbox.test/api","csrf":"dev","translation":"en","debug":true,"search":{"limit":10}}</script>
How are the Urls set up there? Are they correct?
This issue occurs before the panel is even loaded, I can reproduce this in my REST client (which obviously is not executing JS). It’s literally an HTTP redirect, not a JavaScript redirect.
I did some more digging to narrow this down. The following is tested on the 3.0.0
Starterkit.
The index.php
is modified to change the index URL (specifically, to eliminate the port number, which is unwanted (from Docker container mapping)).
echo (new Kirby([
'urls' => [
'index' => url::scheme() . '://' . $_SERVER['SERVER_NAME'],
],
]))->render();
I would recommend using a REST client or curl
to test this. Specifically, you do not want to pre-load the URL (which your browser may do) and you do not want to follow redirects.
Perform a GET on http://localhost/panel
(do not allow redirect following). My REST client returns the following:
HTTP/1.1 302 Found
Date: Thu, 17 Jan 2019 19:55:05 GMT
Transfer-Encoding: Identity
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Location: http://localhost:8080/panel
Server: nginx
If you attempt to load the URL again, or if you have already loaded the panel before, delete the folder located at media/panel
. When this folder exists, the issue does not occur. Deleting this media/panel folder
causes the issue to occur on next load.
Note, in the response that the returned location has :8080
in it. This is unexpected, considering the index URL that was previously configured.
I narrowed the "problematic" code, to Line 65 in the kirby/src/Cms/Panel.php
file, within the render(App $kirby)
function.
go($kirby->request()->url());
Although the request may have a port number tacked on, that does not mean that it should be used to construct URLs (for redirects or otherwise). If doing a redirect is absolutely necessary, it should be consulting the Kirby object for the proper way to construct the URL.
Sorry that it took so long and thank you for the wonderful help with finding the issue. I think I just fixed it, but it would be great if you could test it as well. It's now on the develop branch and will be in the 3.0.3 pre-release next week as well.
I'm closing the ticket to stay organized. Feel free to reopen it if you run into further issues.
Describe the bug On the very first set up of a Kirby 3 installation, when trying to access the panel, Kirby does a redirect but does account for a custom URL index configured in the
index.php
file.Any further attempts to access the
/panel
path work correctly, so I assume it's doing one-time set up stuff like creating panel files?In my case, my custom index URL removes the port number because of Docker mapping. But Kirby redirects to the port version.
To Reproduce Steps to reproduce the behavior:
/panel
Expected behavior The redirect should happen at the exact same URL (or, take into account the custom index URL).
Kirby Version
3.0.0-RC-5.0