pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

Issue with Pgadmin4 Docker nginx reverse proxy

Open Anbuselvam2001 opened this issue 1 year ago • 0 comments

My Docker-Compose file is ..

version: "3.7"
services:
  nginx:
    image: nginx:stable-alpine
    ports:
      - "5051:80"  # Adjust port if needed
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
    networks:

      - pgadmin_net
  pgadmin:
    restart: always
    container_name: pgadmin
    image: dpage/pgadmin4:8.1
    environment:
      - [email protected]
      - PGADMIN_DEFAULT_PASSWORD=ads321
      - PGADMIN_DISABLE_POSTFIX=true
      #- PGADMIN_ENABLE_TLS=false
      - PGADMIN_LISTEN_ADDRESS=0.0.0.0
      - PGADMIN_LISTEN_PORT=80
      - SCRIPT_NAME=/pgadmin4

    networks:
      - pgadmin_net

networks:
 pgadmin_net:
   driver: bridge

my nginx config is

server {

  include       /etc/nginx/mime.types;

  listen 80;  # Adjust port if needed

  location /pgadmin4/ {  # Replace with your desired prefix
    proxy_pass http://pgadmin:80;  # Adjust port if different
    proxy_pass_header Server;
                 proxy_set_header Host $http_host;
                 proxy_redirect off;
                 proxy_set_header X-Real-IP $remote_addr;
                 proxy_set_header X-Scheme $scheme;
                 proxy_set_header USE_X_FORWARDED_HOST True;
                 proxy_set_header SCRIPT_NAME /pgadmin4;
                 proxy_connect_timeout 6000;
                 proxy_read_timeout 6000;
 }
}

Am getting below error in browser console

Refused to execute script from 'http://localhost:5051/pgadmin4/login?next=%2Fpgadmin4%2Fbrowser%2F' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

image

Sometimes am getting login page. After login the website getting refreshed automatically.

Anbuselvam2001 avatar May 16 '24 06:05 Anbuselvam2001