Trouble Logging In and Accessing Panel on Local Dev Server Because of Port#

Hi. I am using Local 5 (with Apache) by Flywheel as my development server. I am trying out the latest Kirby (plainkit, download 7/27/2020). I can create a new account fine, but when I try to log in to the panel at kirby.local/panel I get the error “The Panel cannot connect to the API.” I have a workaround, but this seems like a bug as I have no problem on any non-panel page. Same problem with Chrome, Firefox, and Safari. Firefox and Safari have no plugins/extensions.

I view all non-panel pages at http://kirby.local. But to get to the panel, I have to use kirby.local:10039/. Finding that port number was not easy, and I still don’t have the port number for HTTPS. Each Local 5 install of Kirby will probably get a different port number, so it is a problem. This is probably a “Local 5” issue, but I don’t understand why I can access the front-end without the port number, but it is required to access the panel.

Even when using the port number, when Kirby logs me out, I can’t log back in. In this case there is no error, but it refuses my username/passsword combo. I have to delete account and re-create it.

Try setting the base URL in the config to match the Local 5 address and port.

Have you checked your browser console for more detailed errors? Local is first and foremost a WP dev environment. It should run with other CMS, but maybe not ideal.

Thanks for the idea (and providing a link in the docs). Unfortunately, it did not help. I also tried setting the base URL wrong, and it did not affect even routing to pages, but it did break CSS.

I’ve been using Flywheel for many things besides WP happily so far…

There are errors, but I don’t know how to interpret them. The first error is when app.js calls http://3dkirby.local:10039/api/system?view=panel. The status is (failed). Next, something called “other” calls the same URL and gets a status 404. But I can put the URL in the address bar and can see the JSON just fine.

Hm, I tested it and when I click on “View site” I automatically get the URL with the port and Kirby works without issues including the Panel (I put everything into the app folder) inside the main folder, don’t know if that makes any difference.

Without the port, there are all sorts of CROSS origin issues, though, probably the same that you see. Maybe you need some additional htaccess rules to fix this. But I’m not familiar with Local at all.

I am now convinced that this is a Local problem. Even though I specify Apache server, the first request on a page is reported in the HTTP header to be served by Nginx. Local must be using Nginx to route the (hidden from the user) port to Apache, but if the port is not explicitly used in the address bar, sometimes it includes a port number and sometimes it doesn’t. Sometimes it forwards the wrong port. For example, when using https, it passes along the 10039 port number for style.css, even though the ssl port is 443. This obvious error leads me to believe that this whole problem is Locals.

It might be a problem with the Mac version of Local, I never see the port number show up in the URL like you have when using the view site button. If it was not hidden, there probably would not have been any problems.

Thank you for your help. I will report what I found to Flywheel.

Solved – It was a Kirby config issue, not a Local 5 problem. @jimbobrjames was right in that I need to set the base URL in the config. The trick, though, is to exclude the port because the Local 5 proxy takes care of that correctly. Without the base URL, Kirby sometimes builds URLs with the port and sometimes without. If I use ‘url’ => ‘http://3dkirby.local’ everything works. If I put ‘url’ => ‘https://3dkirby.local’ everything works under SSL. Thanks so much for the help from @jimbobrjames and @texnixe.