Do you want to get rid of that annoying HTTP Status 404 - Not Found error you receive every time you forget to add /guacamole to the end of your Guacamole instance URL?

error 404

Yeah, I think you do. So read on!

By default, Apache Guacamole is NOT accessible at the root / of your domain name, but rather at https://<your fqdn>/guacamole. We suppose that guacamole.traefik.me is your FQDN. When you try to access Guacamole at https://guacamole.traefik.me instead of https://guacamole.traefik.me/guacamole, you receive the error above.

Fortunately, we can change that behavior.

First method

If you installed the application following my Apache Guacamole: manual installation with docker-compose blog post, then you’re using Docker. And the official Guacamole docker image supports the environment variable WEBAPP_CONTEXT which allow overriding the default path. Setting its value to ROOT will make your Guacamole instance accessible via the ROOT / of your FQDN. Edit the ${HOME}/docker-stack/docker-compose.yml file we created in the previous blog post to add the environment variable.

[...]
    
  # guacamole
  guacamole:
    container_name: guacamole_frontend
    depends_on:
    - guacd
    - postgres
    environment:
      WEBAPP_CONTEXT: 'ROOT'
      [...]

Run the command below to apply the change:

docker-compose -f ${HOME}/docker-stack/guacamole/docker-compose.yml up -d

Now your instance is no more reachable at /guacamole. If you wish to keep both paths (/guacamole and /) working, keep reading.

Second method

Alternatively, if you serve Guacamole through a reverse proxy (like HAProxy) as I do, the configuration can be altered slightly to handle requests at a different location externally while still serving internal requests at /guacamole/.

Edit the ${HOME}/docker-stack/haproxy/haproxy.cfg file we created in the previous blog post:

[...]

backend "${ENDPOINT}"
  acl begins_with_guacamole path_beg /guacamole/ /guacamole
  http-request redirect code 301 prefix /guacamole unless begins_with_guacamole
  server guacamole guacamole:8080 check inter 10s resolvers docker_resolver

Then restart the HAProxy container to apply the change:

docker restart haproxy

I personally prefer this way because it makes Guacamole reachable at both http(s)://<your fqdn>/ and http(s)://<your fqdn>/guacamole/. And you can also include additional paths if you want.


Thank you for reading this article all the way to the end! I hope you found the information and insights shared here to be valuable and interesting. Get in touch with me on LinkedIn

I appreciate your support and look forward to sharing more content with you in the future. Until next time!

This post also appears on Medium

References