brocessing / kirby-webpack

:muscle: A Kirby CMS starter-kit with modern frontend tools
MIT License
179 stars 23 forks source link

Blank panel after upgrading to Kirby 3.6.0 #72

Open nncrns opened 2 years ago

nncrns commented 2 years ago

Hi there! I just upgraded my site to Kirby 3.6.0 and the frontend is working fine, however I get a blank page when trying to visit the panel. The console error message reads:

DOMException: Failed to execute 'pushState' on 'History': A history state object with URL 'http://localhost:35411/panel/site' cannot be created in a document with origin 'http://localhost:8080' and URL 'http://localhost:8080/panel/site'.

    at Object.setState (http://localhost:8080/media/panel/84e399b8f2181ccd73394fdeddff1638/js/index.js:1:14524)
    at Object.init (http://localhost:8080/media/panel/84e399b8f2181ccd73394fdeddff1638/js/index.js:1:12871)
    at a.created (http://localhost:8080/media/panel/84e399b8f2181ccd73394fdeddff1638/js/index.js:1:14845)
    at Vt (http://localhost:8080/media/panel/84e399b8f2181ccd73394fdeddff1638/js/vendor.js:6:11291)
    at nn (http://localhost:8080/media/panel/84e399b8f2181ccd73394fdeddff1638/js/vendor.js:6:25303)
    at a.Cn._init (http://localhost:8080/media/panel/84e399b8f2181ccd73394fdeddff1638/js/vendor.js:6:32894)
    at new a (http://localhost:8080/media/panel/84e399b8f2181ccd73394fdeddff1638/js/vendor.js:6:30461)
    at http://localhost:8080/media/panel/84e399b8f2181ccd73394fdeddff1638/js/vendor.js:6:19454
    at init (http://localhost:8080/media/panel/84e399b8f2181ccd73394fdeddff1638/js/vendor.js:6:19485)
    at http://localhost:8080/media/panel/84e399b8f2181ccd73394fdeddff1638/js/vendor.js:6:56812

Am unfortunately not skilled enough to know how to read this and what to do. Any pointers? Thanks in advance!

nncrns commented 2 years ago

As this is a fairly urgent issue, I did my own digging and found this thread:

https://github.com/getkirby/kirby/issues/3645

Unfortunately I don't understand any of it 😅 But maybe it helps in solving this?

fabianmichael commented 2 years ago

I also had a blank screen issue on an IONOS webspace. It was caused when history.pushState() tried to push the non-ww URL of the website as path, while the panel loaded from the www-version. At IONOS, SERVER_NAME is set to the domain without www prefix, but HTTP_HOST contains www. I was able to fix that temporarely by adding the following line to my index.php file before loading anything else:

$_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];
vitali-sigel commented 2 years ago
$_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];

This temporary solution works for me 👍

GeraldGrote commented 2 years ago

I just ran into the same issue: A mismatch of SERVER_NAME and HTTP_HOST caused the panel to fail. (Typical redirect to www.... domain).

Curiously no error logged in Chrome and Safari, Firefox logged: "DOMException: The operation is insecure"

I solved this by switching ServerName and ServerAlias in the apache config to match the actual used sub-domain.

But this might be not possible in environments where you have limited serveraccess or more complicated setups (proxies, load balancing, multisite configs, ...)

arnaudjuracek commented 2 years ago

In my setup the blank panel was due to a port mismatch, and was solved by using this index.php :

<?php

require __DIR__ . '/kirby/bootstrap.php';

// Fix blank panel on Kirby 3.6.2 with kirby-webpack
if (($_SERVER['HTTP_X_FORWARDED_FOR'] ?? null) === 'webpack') {
  $_SERVER['SERVER_PORT'] = 8080;
}

echo (new Kirby)->render();

Where 8080 is the matching port of your BrowserSync options.