Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image v4.0.0 web UI redirects to localhost #2103

Closed
SilentResonance opened this issue Oct 27, 2024 · 5 comments
Closed

Docker image v4.0.0 web UI redirects to localhost #2103

SilentResonance opened this issue Oct 27, 2024 · 5 comments

Comments

@SilentResonance
Copy link

SilentResonance commented Oct 27, 2024

Version:

  • listmonk: v4.0.0.
  • OS: Ubuntu 22.04.5 LTS
  • Docker: 24.0.7

Description of the bug and steps to reproduce:

  1. Remove all containers and volumes based on current docker-compose.yml, which might be already existing
  2. Download/Overwrite docker-compose.yml with wget https://github.com/knadh/listmonk/raw/master/docker-compose.yml
  3. Edit the new docker-compose.yml
    • Comment the lines containing: LISTMONK_ADMIN_USER and LISTMONK_ADMIN_PASSWORD
    • In the database ports section: Change "- 5432:5432" to - "5432" to not expose the database port to the host (encountered errors here due to an already exposed port from another container)
  4. Run docker pull to update needed images
  5. Run docker compose up db to create a running postgres instance
  6. Run docker-compose run --rm app ./listmonk --install to create new database
  7. Run docker-compose up to start app instance
  8. Open a web browser to <Server-IP>:9000 the dialog to create Super-Admin credentials should show up
  9. Enter new e-mail, username and password
  10. Click "Continue"
  11. Here the URL changes to localhost:9000/admin/login instead of <Server-IP>:9000/admin/login which cannot work from a remote PC.

Edit
Added an Nginx reverse proxy to allow SSL and fully working DNS
Setting the forms action URL to <Server-DNS-Name>:9000/admin/login in Firefox web developer console allowed a login.
In order to correct the form's action host, change the Root URL under Settings -> Settings.
But even with reverse proxy, it only works with port 9000 in Root URL. My local DNS resolves to my local net IPs, that's why it is working here.

Update
My Root URL was still starting http://
With this, the login does not work, if the reverse proxy login originates from https.
Still, the redirect to localhost is a problem after fresh install when trying to configure from external PC.

Did anyone else encounter that localhost redirect problem? Is it possible to add a Root URL variable in docker-compose.yml or is there already a possibility to change it there for installation?
I am looking forward to use listmonk with keycloak multi-user access. That is the reason for the update to v4.0.0
Thanks for any help.

@salim-b
Copy link
Contributor

salim-b commented Oct 29, 2024

@knadh This is still an issue. With f5dfb0c, the login page is now displayed fine, but we get redirected to http://localhost:9000/admin/login after pressing the login button (and before having a chance to change the Root URL to our actual public address).

I think the {{ .RootURL }} prefix also needs to be removed from this template: https://github.com/knadh/listmonk/blob/master/static/public/templates/login.html, no?

@JustAnotherTill
Copy link

With version v4.0.1 installed, I can confirm that I still get redirected to http://localhost:9000 after login.

@juffinger
Copy link

I had the same problem: The first login after setup worked but every further login ended on localhost:9000.
I solved it by setting immediately the root url to my own domain under Settings - I no longer had any problems.
Hope it helps!

@salim-b
Copy link
Contributor

salim-b commented Nov 6, 2024

@knadh I still don't feel comfortable enough with listmonks's internals to submit a PR. But what I think is relevant to this issue:

  1. Why do we need absolute URLs in the Go HTML templates in the first place? With relative URLs, we would at least be able to navigate to the settings page where the root URL can be changed.

  2. The root URL is, like all other settings, stored in the listmonk PostgreSQL DB's settings table (in the row where key = 'app.root_url') and defaults to localhost after deployment. There is no officially documented way to set the root URL before deployment, which would be the real solution here, I think.

    The code seems to read two relevant environment variables at some places, but I dunno enough about Vue.js to really make sense of them:

    I didn't yet test setting any of them before deployment, so I can't tell whether they're already enough to set listmonk's root URL. Maybe you could shed some light on the purpose of those vars?

    Besides, this past discussion seems relevant.

@Seneral
Copy link

Seneral commented Jan 12, 2025

Agree the form url should be relative.
I actually got the opposite issue, I had set the root url, but don't allow access to the admin panel at all through the public facing url (root url), so I have to change the forms action URL to my local one for it to work.
Just set it to relative and allow whatever access method the user chose to continue working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants