Open micchickenburger opened 2 years ago
This appears to be a Yii bug. I’ve just submitted a bug report about it: yiisoft/yii2#19290
In the meantime, you can fix by manually defining your @web
alias to http://localhost:5000
. Add this to config/general.php
:
'aliases' => [
'@web' => 'http://localhost:5000',
],
(Ideally the actual value should be defined by an environment variable, and you pull it in via craft\helpers\App::env('ENV_VAR_NAME')
, as it’s going to change depending on the environment.)
Thanks for your reply. I tried this configuration but it did not change the outcome. The admin interface still seems to hardcode resources to port 80.
Have you overridden your resourceBaseUrl
config setting by chance?
Nope, what you see above is my configuration.
Did you add the aliases
key within the *
array or at the top level? It should be:
return [
'*' => [
// Control Panel access via environment variable
'baseCpUrl' => craft\helpers\App::env('BASE_CP_URL') ?: null,
// Control Panel trigger word
'cpTrigger' => 'admin-login',
'aliases' => [
'@web' => 'http://localhost:5000',
],
],
];
I tried both to the same effect. :-/ Is there some way I can be more helpful? Some other configuration I can share?
Inspect the initial webpage request – does it specify the port in the Host
header?
For example, here’s a request for port 8080
:
Description
The control panel doesn't seem to load resources properly when running craft on non-standard ports. The links all reference the correct port but resources like images, scripts, and stylesheets drop the port number.
It just tries to load resources from
localhost
even though I configured theBASE_CP_URL
to belocalhost:5000
.docker-compose.yml
config/general.php
We do not use
.env
files.Steps to reproduce
Additional info