In Kirby 2 we solved it in the config with this hack:
if ($_SERVER['HTTP_X_REAL_IP'] == $_SERVER['SERVER_ADDR']) {
c::set('url', "http://{$_SERVER['SERVER_ADDR']}/plesk-site-preview/{$_SERVER['SERVER_NAME']}/{$_SERVER['SERVER_ADDR']}/");
}
But in Kirby 3 this doesn’t work. Although images are shown in the panel it gets redirected to a wrong URL and in the frontend subpages are not working anymore.
This is really a big issue to us, no ideas for a solution and why is this URL thing always that big of a problem with plesk previews?
<?php // file: site/config/config.php
/**
* The config file accepts _ONE_ return array with config options.
* Note: Never include more than one return statement, all options go within this single return array!
*
* All config options: https://getkirby.com/docs/reference/system/options
*/
if ($_SERVER['HTTP_X_REAL_IP'] == $_SERVER['SERVER_ADDR']) {
$myurl = "http://{$_SERVER['SERVER_ADDR']}/plesk-site-preview/{$_SERVER['SERVER_NAME']}/{$_SERVER['SERVER_ADDR']}/"; // change this line to fit your need
} else {
$myurl = false; // Kirby auto-detects the correct URL
};
return [
'debug' => true, // This setting must be set to false in production!!!
// some code, if you need
'url' => $myurl,
// some code, if you need
];
Thank you @anon77445132 and @texnixe , unfortunately the problem was not with migrating the code to kirby 3, I did that with: (sorry for not posting this)
The problem is that this change has effect, but not the one expected, the panel images work but the URL of the browser gets redirected to a broken URL - which is not a problem for using the panel because everything is Ajax, but you can’t reload the panel page.
May be you can set some routes “against” your problems. Sorry, I cannot help you in the details, but with this try you can change every route specific.
Or can you solve this in the plesk admin interface?