whodb icon indicating copy to clipboard operation
whodb copied to clipboard

[QUESTION/MISC] - How can I set BASE_URL or ROOT_URL for UI

Open ducminhle opened this issue 3 months ago • 1 comments

Hi team,

When I deploy WhoDB with Docker Compose, I would like to use Nginx to reverse proxy from port 80/443 to WhoDB.

Example:

https://abx.xyz/whodb

I don't know how to set the BASE URL or ROOT URL for WhoDB.
Where can I configure this, or is there any documentation about it? I've searched but haven't found any documentation that covers this.

ducminhle avatar Oct 11 '25 06:10 ducminhle

Hey thanks for your issue! We don't have any support for setting a BASE URL or ROOT URL.

I think you'd have to just set up the Nginx proxy to point to whatever port you expose the whodb container on in your Docker compose. So something like this if your nginx is outside of docker compose but on the same machine:

  location /whodb {
      # Remove /whodb prefix
      rewrite ^/whodb/(.*)$ /$1 break;

      # Forward to WhoDB container
      proxy_pass http://localhost:8080;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;

      # WebSocket support for GraphQL subscriptions
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
  }

  location /whodb/api {
      # API calls
      rewrite ^/whodb/(.*)$ /$1 break;
      proxy_pass http://whodb-container:8080;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
  }

and then something like this if your nginx is in the docker compose:

 # docker-compose.yml
  services:
    whodb:
      image: clidey/whodb
      ports:
        - "8080:8080"

    nginx:
      image: nginx
      ports:
        - "80:80"
        - "443:443"
      volumes:
        - ./nginx.conf:/etc/nginx/nginx.conf

  # Nginx config would use the service name:
  location /whodb {
      rewrite ^/whodb/(.*)$ /$1 break;
      proxy_pass http://whodb:8080;  # Use service name and container port
      proxy_set_header Host $host;
      # ... other headers
  }

modelorona avatar Oct 15 '25 12:10 modelorona