@alessandro If you try to understand the paths and constants, have a look here:
Explanation of all paths and constants
A few weeks ago, I started to analyze all the paths and constants. For most of them I added a few lines of explanation. I will update this list with the missing parts when I find the time to do it.
The example paths are on an Uberspace (CentOS 7) in ~/html/cockpit.
Originally, I wrote this text in kramdown and rendered it to HTML. If you want to see the rendered file with a table of contents, have a look here:
source .md , source .html
view via htmlpr…
I’m not sure, how to achieve the forwarding, but maybe… it could be easy… Put Cockpit in a subdirectory named cockpit
→ now your url is localhost:8080/cockpit/auth/login
Or add a line to the .htaccess
to rewrite some specific urls.
And you started a second thread
Hello,
I’m using cockpit cms with docker. Cockpit is exposed on my machine on localhost:8080.
How to expose cockpit on localhost:8080/[prefix]/ where prefix can be something like ‘cockpit’ or ‘cms’.
I’d need to tell cockpit to refer to itself as localhost:8080/[prefix]/ and not just localhost:8080
Thank you
Have a look at index.php of Cockpit:
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
define('COCKPIT_ADMIN', 1);
// set default timezone
date_default_timezone_set('UTC');
// handle php webserver
if (PHP_SAPI == 'cli-server' && is_file(__DIR__.parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
return false;
}
// bootstrap cockpit
require(__DIR__.'/bootstrap.php');
# admin route
if (COCKPIT_ADMIN && !defined('COCKPIT_ADMIN_ROUTE')) {
$route = preg_replace('#'.preg_quote(COCKPIT_BASE_URL, '#').'#', '', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), 1);
if ($route == '') {
$route = '/';
}
define('COCKPIT_ADMIN_ROUTE', $route);
}
if (COCKPIT_API_REQUEST) {
$_cors = $cockpit->retrieve('config/cors', []);
header('Access-Control-Allow-Origin: ' .($_cors['allowedOrigins'] ?? '*'));
header('Access-Control-Allow-Credentials: ' .($_cors['allowCredentials'] ?? 'true'));
header('Access-Control-Max-Age: ' .($_cors['maxAge'] ?? '1000'));
header('Access-Control-Allow-Headers: ' .($_cors['allowedHeaders'] ?? 'X-Requested-With, Content-Type, Origin, Cache-Control, Pragma, Authorization, Accept, Accept-Encoding, Cockpit-Token'));
header('Access-Control-Allow-Methods: ' .($_cors['allowedMethods'] ?? 'PUT, POST, GET, OPTIONS, DELETE'));
header('Access-Control-Expose-Headers: ' .($_cors['exposedHeaders'] ?? 'true'));
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
exit(0);
Maybe this might work: define the constant COCKPIT_ADMIN_ROUTE
in /config/bootstrap.php
to your needs.