elkozmon / zoonavigator

Web-based ZooKeeper UI / editor / browser
https://zoonavigator.elkozmon.com
GNU Affero General Public License v3.0
506 stars 72 forks source link

Host not allowed: zoonavigator:9000 #47

Closed douglasramiro closed 4 years ago

douglasramiro commented 4 years ago

Hi,

I am starting the container as documentations asks:

docker run \

-d --network host \ -e HTTP_PORT=9000 \ --name zoonavigator \ --restart unless-stopped \ elkozmon/zoonavigator:latest

I can access the zoonavigator using the address localhost:9000

However, I am not able to access zoonavigator externally by hostname. I am receiving the following error:

{"success":false,"message":"Host not allowed: zoonavigator:9000"}

How to easily reproduce:

edit /etc/hosts and add zoonavigator to the line that begins with 127.0.0.1

Start the container with

docker run \

-d --network host \ -e HTTP_PORT=9000 \ --name zoonavigator \ --restart unless-stopped \ elkozmon/zoonavigator:latest

Try to access the web application using a web browser.

I could not find any setting to allow a different host.

Thanks

douglasramiro commented 4 years ago

I could make it work by changing the application.conf:

play {
  application.loader = AppLoader

  # HTTP configuration
  server.http.port = 9000

  # Session TTL in milliseconds
  http.session.maxAge = 900000

  # Allow large requests (imports)
  http.parser.maxMemoryBuffer = 10m

  # Allow all origins
  filters.cors.allowedOrigins = null

  # Filters
  filters {
    enabled = []
    enabled += "play.filters.headers.SecurityHeadersFilter"
    enabled += "play.filters.hosts.AllowedHostsFilter"
    enabled += "play.filters.cors.CORSFilter"
    #enabled += "play.filters.csrf.CSRFFilter"
  }

  filters.hosts = {
    allowed = ["."]
  }

  # Assets
  assets {
    path = "/public"
    urlPrefix = "/"
  }
}

I just included the following snippet:

filters.hosts = {
    allowed = ["."]
  }

I am not sure if it is the best option. If you think that this is the best option, could you please update the version? I don't want to run my own image because I will lose the updates. By the way, congrats, this is an awesome project!

elkozmon commented 4 years ago

Hi!

Ooops, I must have accidentally left the play.filters.hosts.AllowedHostsFilter filter enabled.

This only affects the latest docker image, so I'm gonna rebuild it in a minute.

Thank you for letting me know, and good job for coming up with your own fix btw :)

elkozmon commented 4 years ago

You can pull the new image now :)