mirror of
https://github.com/modoboa/modoboa.git
synced 2026-04-25 00:46:03 +03:00
[GH-ISSUE #3377] Blank Admin v2 interface #1843
Labels
No labels
bug
bug
dependencies
design
documentation
duplicate
enhancement
enhancement
enhancement
feedback-needed
help-needed
help-needed
installer
invalid
looking-for-sponsors
modoboa-contacts
new-ui
new-ui
pr
pull-request
pyconfr
python
question
security
stale
webmail
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/modoboa-modoboa#1843
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @olaf7 on GitHub (Dec 19, 2024).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/3377
After upgrading to 2.3.0 on Debian Bookworm virtualenv manual installation using MariaDB, Nginx, Supervisor, gunicornL
I can login to the v1 admin panel. It provides a button to open the v2 interface. When I open this link in a new window on Chromium I get a blank screen (in settings.py Debug is enabled). When I check using developer tools and record the reload I get:
@tonioo commented on GitHub (Dec 20, 2024):
@olaf7 Can you check the content of the config.json file ?
@olaf7 commented on GitHub (Dec 20, 2024):
The confg.json in env/instance :
{ "API_BASE_URL": "https://modoboa.example.net/api/v2/" }@tonioo commented on GitHub (Dec 20, 2024):
I think you forgot some steps during the upgrade process. You should have more settings in this file
@olaf7 commented on GitHub (Dec 20, 2024):
After reviewing again I can think of no step I might have forgotten. Which one(s) spring to mind?
@olaf7 commented on GitHub (Dec 20, 2024):
Only thing noticeable is a warning when issuing check --deploy :
?: (security.W001) You do not have 'django.middleware.security.SecurityMiddleware' in your MIDDLEWARE so the SECURE_HSTS_SECONDS, SECURE_CONTENT_TYPE_NOSNIFF, SECURE_REFERRER_POLICY, SECURE_CROSS_ORIGIN_OPENER_POLICY, and SECURE_SSL_REDIRECT settings will have no effect.
But the middleware definition is a copy/paste from the upgrade instructions.
@tonioo commented on GitHub (Dec 20, 2024):
Did you run those ones:
https://modoboa.readthedocs.io/en/latest/upgrade.html#post-upgrade-commands
?
@olaf7 commented on GitHub (Dec 20, 2024):
Yes I did
@olaf7 commented on GitHub (Dec 20, 2024):
When I run the upgrade process on another Modoboa (test) instance I get an error in the upgrade process:
(which can be fixed by applying the changes as suggested next in the update documentation)
after the following migrations:
The Modoboa instance that I am trying to get working (and which is the one I am reporting about) however says:
So it seems the oauth2_provider migration is fully applied, but the oauth settings in config.json are missing.
@Spitfireap commented on GitHub (Dec 21, 2024):
@olaf7, the command that populates config.json is this one if I remember correctly :
python manage.py load_initial_data@olaf7 commented on GitHub (Dec 21, 2024):
@Spitfireap I reapplied that command (again) and sadly the config.json file still only has 1 URI definition in it. Any way I can debug this?
Only output I got is:
@olaf7 commented on GitHub (Dec 31, 2024):
I tried to run the command again with --verbosity=3 but that did not provide more output, so I am stuck.
@tonioo commented on GitHub (Jan 16, 2025):
If the load_initial_data command completes, your config.json file should contain more than what you see. Are you sure you're running latest modoboa version?
@olaf7 commented on GitHub (Jan 16, 2025):
Yes, I am sure. Just double checked: 2.3.0
Reapplying the command does unfortunately not fix/extend the json file.
@tonioo commented on GitHub (Jan 16, 2025):
Could you try with 2.3.4?
@olaf7 commented on GitHub (Jan 17, 2025):
Done. Unfortunately the confg.json file still has only 1 definition in it as before. (no changes)
@tonioo commented on GitHub (Jan 21, 2025):
Can you check if you find another frontend/ folder within /srv/modoboa ?
@olaf7 commented on GitHub (Jan 21, 2025):
Ah. It appears there are two config.json files on my system. One in the modoboa root directory holding just the api_base_url and one in a subdirectory called 'frontend' having also 4 oauth_ settings in it. Problem persist though.
Note all URIs refer to localhost. Is this as it should be?
@tonioo commented on GitHub (Jan 22, 2025):
Yes for URIs. Now, you need to update nginx configuration and tell it to use this new folder you found instead of the old one.
@olaf7 commented on GitHub (Jan 22, 2025):
Great. I thought so too, but that makes me wonder...
Did something go wrong somehow and are files placed at a wrong location? If so that will likely have impact on future updates.
Also: the v1 admin panel works fine. The v2 starts to load and then fails, so I assume it is not just a rewrite rule for 'new-admin'?
I will give this a spin asap
@olaf7 commented on GitHub (Jan 22, 2025):
I am not sure what to rewrite. I double checked my nginx config and compared it to what the installer would produce. I also rechecked the output of Developer Tools, but it remains as reported above. I also checked nginx logs and supervisor and gunicorn logs, but I see no errors in these.
The errors (see above) mention localhost. Again no errors in the main nginx logs.
Happy about the extended config, but still stuck.
@tonioo commented on GitHub (Jan 23, 2025):
The difference with path might be the result of a confusion in the upgrade instructions of the documentation... But it's safe to keep the version deployed by the management command.
Could you paste the error you see now? And do you any reference to localhost in config.json file?
@olaf7 commented on GitHub (Jan 23, 2025):
Note: previously the v2 admin interface used to work,
For sake of completeness:
nginx config snipit:
`
`
cat /srv/modoboa/env/instance/frontend/config.json
`
{
"API_BASE_URL": "https://localhost/api/v2",
"OAUTH_AUTHORITY_URL": "https://localhost/api/o",
"OAUTH_CLIENT_ID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"OAUTH_REDIRECT_URI": "https://localhost/new-admin/login/logged",
"OAUTH_POST_REDIRECT_URI": "https://localhost/new-admin"
}
`
No errors in logs or on screen (blank).
Output of Developer Tools in Chromium (and Firefox):
`
has an unsupported `type` value localhost/api/o/.well-known/openid-configuration:1index-CyvlV96y.js:26 Error: Unable to preload CSS for /new-admin/assets/VApp-CAg9RG4k.css
at HTMLLinkElement. (index-CyvlV96y.js:22:2327)
wt @ index-CyvlV96y.js:26
index-CyvlV96y.js:38
index-CyvlV96y.js:22 Uncaught (in promise) Error: Unable to preload CSS for /new-admin/assets/VToolbar-BVnJSNDw.css
at HTMLLinkElement. (index-CyvlV96y.js:22:2327)
6The resource was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate
asvalue and it is preloaded intentionally.Navigated to https://modoboa.example.net/new-admin/
new-admin/:6 has an unsupported
typevalueindex-CyvlV96y.js:38
fetchWithTimeout @ index-CyvlV96y.js:38
getJson @ index-CyvlV96y.js:38
getMetadata @ index-CyvlV96y.js:38
_getMetadataProperty @ index-CyvlV96y.js:38
getAuthorizationEndpoint @ index-CyvlV96y.js:38
createSigninRequest @ index-CyvlV96y.js:38
_signinStart @ index-CyvlV96y.js:38
signinRedirect @ index-CyvlV96y.js:38
await in signinRedirect
W @ index-CyvlV96y.js:38
await in W
(anonymous) @ index-CyvlV96y.js:30
(anonymous) @ index-CyvlV96y.js:38
await in (anonymous)
(anonymous) @ index-CyvlV96y.js:26
f @ index-CyvlV96y.js:26
(anonymous) @ index-CyvlV96y.js:26
(anonymous) @ index-CyvlV96y.js:26
runWithContext @ index-CyvlV96y.js:14
oe @ index-CyvlV96y.js:26
(anonymous) @ index-CyvlV96y.js:26
Promise.then
(anonymous) @ index-CyvlV96y.js:26
Qe @ index-CyvlV96y.js:26
(anonymous) @ index-CyvlV96y.js:26
Promise.then
ve @ index-CyvlV96y.js:26
ue @ index-CyvlV96y.js:26
ue @ index-CyvlV96y.js:26
J @ index-CyvlV96y.js:26
install @ index-CyvlV96y.js:26
use @ index-CyvlV96y.js:14
N1 @ index-CyvlV96y.js:740
(anonymous) @ index-CyvlV96y.js:740
Promise.then
(anonymous) @ index-CyvlV96y.js:740
Promise.then
(anonymous) @ index-CyvlV96y.js:740
index-CyvlV96y.js:26 Error: Unable to preload CSS for /new-admin/assets/VAvatar-BChM8Z-8.css
at HTMLLinkElement. (index-CyvlV96y.js:22:2327)
wt @ index-CyvlV96y.js:26
(anonymous) @ index-CyvlV96y.js:26
Promise.catch
ue @ index-CyvlV96y.js:26
ue @ index-CyvlV96y.js:26
J @ index-CyvlV96y.js:26
install @ index-CyvlV96y.js:26
use @ index-CyvlV96y.js:14
N1 @ index-CyvlV96y.js:740
(anonymous) @ index-CyvlV96y.js:740
Promise.then
(anonymous) @ index-CyvlV96y.js:740
Promise.then
(anonymous) @ index-CyvlV96y.js:740
index-CyvlV96y.js:38
fetchWithTimeout @ index-CyvlV96y.js:38
getJson @ index-CyvlV96y.js:38
getMetadata @ index-CyvlV96y.js:38
_getMetadataProperty @ index-CyvlV96y.js:38
getAuthorizationEndpoint @ index-CyvlV96y.js:38
createSigninRequest @ index-CyvlV96y.js:38
signinStart @ index-CyvlV96y.js:38
signinRedirect @ index-CyvlV96y.js:38
await in signinRedirect
W @ index-CyvlV96y.js:38
await in W
(anonymous) @ index-CyvlV96y.js:30
(anonymous) @ index-CyvlV96y.js:38
await in (anonymous)
(anonymous) @ index-CyvlV96y.js:26
f @ index-CyvlV96y.js:26
(anonymous) @ index-CyvlV96y.js:26
(anonymous) @ index-CyvlV96y.js:26
runWithContext @ index-CyvlV96y.js:14
oe @ index-CyvlV96y.js:26
(anonymous) @ index-CyvlV96y.js:26
Promise.then
(anonymous) @ index-CyvlV96y.js:26
Qe @ index-CyvlV96y.js:26
(anonymous) @ index-CyvlV96y.js:26
Promise.then
ve @ index-CyvlV96y.js:26
ue @ index-CyvlV96y.js:26
ue @ index-CyvlV96y.js:26
J @ index-CyvlV96y.js:26
install @ index-CyvlV96y.js:26
use @ index-CyvlV96y.js:14
N1 @ index-CyvlV96y.js:740
(anonymous) @ index-CyvlV96y.js:740
Promise.then
(anonymous) @ index-CyvlV96y.js:740
Promise.then
(anonymous) @ index-CyvlV96y.js:740
index-CyvlV96y.js:22 Uncaught (in promise) Error: Unable to preload CSS for /new-admin/assets/Dashboard-Cj5OLJ89.css
at HTMLLinkElement. (index-CyvlV96y.js:22:2327)
(anonymous) @ index-CyvlV96y.js:22
error
(anonymous) @ index-CyvlV96y.js:22
(anonymous) @ index-CyvlV96y.js:22
et @ index-CyvlV96y.js:22
component @ index-CyvlV96y.js:38
ro @ index-CyvlV96y.js:26
(anonymous) @ index-CyvlV96y.js:26
Promise.then
ve @ index-CyvlV96y.js:26
ue @ index-CyvlV96y.js:26
ue @ index-CyvlV96y.js:26
J @ index-CyvlV96y.js:26
install @ index-CyvlV96y.js:26
use @ index-CyvlV96y.js:14
N1 @ index-CyvlV96y.js:740
(anonymous) @ index-CyvlV96y.js:740
Promise.then
(anonymous) @ index-CyvlV96y.js:740
Promise.then
(anonymous) @ index-CyvlV96y.js:740
new-admin/:1 The resource https://modoboa.example.net/new-admin/assets/materialdesignicons-webfont-Dp5v-WZN.woff2 was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate
asvalue and it is preloaded intentionally.new-admin/:1 The resource https://modoboa.example.net/new-admin/assets/materialdesignicons-webfont-PXm3-2wK.woff was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate
asvalue and it is preloaded intentionally.new-admin/:1 The resource https://modoboa.example.net/new-admin/assets/materialdesignicons-webfont-B7mPwVP.ttf was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate
asvalue and it is preloaded intentionally.`
@tonioo commented on GitHub (Jan 23, 2025):
You should not have reference to localhost in the config file, but your instance hostname instead.
@olaf7 commented on GitHub (Jan 23, 2025):
After changing all localhost entries in frontend/config.json (which was generated, not edited) to modoboa.example.net I now get a new error:
Error: invalid_request
Mismatching redirect URI.
Which is a HTTP 400 reply on :
https://modoboa.example.net/api/o/authorize/?client_id=etcSo, the URI seems right. Is there another location/configuration I should check which might have a reference to localhost? Or is the URI hased into the clientID or ....?
@tonioo commented on GitHub (Jan 23, 2025):
Ok, then I think there is a issue in your DB. Could you check the content of the django_site table?
@olaf7 commented on GitHub (Jan 23, 2025):
Domain and Name fields are identical. They match the domainname of modoboa: modoboa.example.net
@olaf7 commented on GitHub (Apr 9, 2025):
I just upgraded to 2.3.6 and the error persists, although visually I now get something different: a circle turning stating: attempting to log you on. This sounds as progress as before I needed manually to enter my credentials again, although I was already loged in on the v1 admin interface.
The last error line gets repeated a couple of times.
Any (new) ideas how to resolve this please?
@olaf7 commented on GitHub (Apr 9, 2025):
Only other thing I noticed during the upgrade:
In the Nginx logs I see (as long as the windows is open): "GET /core/top_notifications/check/ HTTP/2.0" 200
The last log which does not give a HTTP 200: "GET /sitestatic/font-awesome/fonts/fontawesome-webfont.woff2?v=4.7.0 HTTP/2.0" 304
Some 200s in front of that and a whole series of other 304s before those.
Hope this helps.
@tonioo commented on GitHub (Apr 11, 2025):
@olaf7 I can see this in your logs:
has an unsupported `type` value localhost/api/o/.well-known/openid-configurationThis should not be localhost but the complete hostname
@tonioo commented on GitHub (Apr 11, 2025):
Are you sure you only have on config.json file ?
@olaf7 commented on GitHub (Apr 11, 2025):
No. I have two:
config.json with just 1 item: API_BASE_URL which contains the fqdn
The other one is in subdirectory "frontend" which contains: API_BASE_URL, OAUTH_AUTHORITY_URL, OAUTH_CLIENT_ID, OAUTH_REDIRECT_URI, OAUTH_POST_REDIRECT_URI.
The URI/URLs do not contain the fqdn but localhost in this file.
Do I need only one config.json? If so, where?
@olaf7 commented on GitHub (Apr 11, 2025):
If I change "localhost" to the fqdn I get a HTTP 400 error: Error: invalid_request
Mismatching redirect URI.
@olaf7 commented on GitHub (Apr 11, 2025):
Basically I am back at Jan 23 in this issue: https://github.com/modoboa/modoboa/issues/3377#issuecomment-2609799172
When upgrading the config.json file gets regenerated and "localhost" is used isntead of the fqdn which I then have to change.
I also tested with the config.json file in the root renamed so it should not load. Problem is the same so this file can probably removed. Is the re-use of "localhost" in the re-generation of config.json a pointer on what might be wrong?
@olaf7 commented on GitHub (Apr 13, 2025):
Most likely there is a link with issue #3527 . However rerunning
python manage.py load_initial_datadid not solve the issue, but will probably prevent 'localhost' to be inserted in files as fqdn in the future on my system."localhost" was the first item in the list ALLOWED_HOSTS in my settings.py
@mirtouf commented on GitHub (Apr 16, 2025):
In my case, I had to ensure consistency for all the listed fqdn between the table oauth2_provider_application (2 rows listing uris) and the config.json file to make sure the new-admin interface is working correctly. Otherwise, you are getting this error 400.
If I understood correctly, this table is populated by grabbing the first fqn listed in settings.py in the ALLOWED_HOSTS sections.
@olaf7 commented on GitHub (Apr 16, 2025):
Thank you! Error 400 can have many causes. The URIs in the browser were right. Including those exposed by Developer Tools.
I had to replace three values of fields in the first row of the oauth table you mentioned. They did still point to localhost. After replacement the issue is resolved.
I do still think this is a bug as the net is filled with documentation and suggestions to fill ALLOWED_HOSTS with host aliases. Especially 127.0.0.1 and localhost. The code never checks on values when applying them (or rather it as only the first hostname is parsed) during installation, but does in production with the result of error 400 without a hint where to fix it.
@stale[bot] commented on GitHub (Jun 26, 2025):
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.