Self-hosted Firefox

check this out… a containerized Firefox that you can self host and run in a browser!

Why? to navigate from your server wherever you are:

  • Bypass local filters/censorship
  • Browse websites like you do from home
  • Levergae your home ad-block setup
  • Keep your browsing history totally private and secure

You will be able to acces your own firefox instance via any other web browser. Inside, it uses a VNC server/client, but toward outside it's just a plain webpage with firefox inside.

Installation

This is one of those use cases where a container is the perfect choice. The stack needed to achieve all this is not trivial and would be potentially not a good idea to set it up server-wide on your home server.

Now, if you plan to use firefox with multiple users you will need to replicate this setup for every user as you will need to spin up a separate container for each one. I will assume that user is the user you want your firefox to run as.

As user create the /home/user/docker-compose.yml file:

docker-compose.yml
version: '3'
services:
  firefox:
    image: jlesage/firefox
    environments:
     - USER_ID=1000
     - GROUP_ID=1000
    ports:
      - "5800:5800"
    volumes:
      - "/user/appdata/firefox:/config:rw"

Adapt your port (5800) and the USER_ID and GROUP_ID for user. You also need to specify a config folder, wihch must be existing and writable by user.

Then the usual:

su - user
podman compose pull

Reverse Proxy

Create the following NGINX config:

firefox.conf
location /firefox/ {
        rewrite ^/firefox/(.*) /$1 break;
        proxy_ignore_client_abort on;
        proxy_pass   http://127.0.0.1:5800;
        proxy_redirect  http://127.0.0.1:5800 /firefox;
        proxy_cookie_path / /firefox/;
    }

See The Reverse Proxy concept for more info.

Autostart

Autostarting at boot might be trickier, i suggest you take a look at Custom User Services and create the links:

cd /etc/local.d
ln -s _services.sh 80-firefox-user-podman.start
ln -s _services.sh 80-firefox-user-podman.stop