pritunl icon indicating copy to clipboard operation
pritunl copied to clipboard

HTTP ERROR 502 on web interface

Open Kiyam opened this issue 4 years ago • 6 comments

Reporting bugs/issues

  • When reporting a bug/issue:

    • Ensure that you are using the latest release.
    • Revert any custom modifications or environment varibles to insure they're not the cause.
  • Please provide the following information:

    • OS/distribution version (command for your OS may differ): IE:
    user@host:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 18.04.4 LTS
    Release:        18.04
    Codename:       bionic
    
    • Docker version: IE:
    user@host:~$ docker --version
    Docker version 19.03.12, build 48a66213fe
    
    • Labels from container: IE:
    user@host:~$ docker inspect goofball222/pritunl:<tagname>
    ...
                "Labels": {
                "org.opencontainers.image.created": "2020-07-07T22:02:21Z",
                "org.opencontainers.image.licenses": "Apache-2.0",
                "org.opencontainers.image.revision": "ac58a4a",
                "org.opencontainers.image.source": "https://github.com/goofball222/pritunl.git",
                "org.opencontainers.image.title": "Pritunl Server",
                "org.opencontainers.image.url": "https://github.com/goofball222/pritunl",
                "org.opencontainers.image.vendor": "The Goofball - [email protected]",
                "org.opencontainers.image.version": "1.29.2490.44"
            }
    ...
    
    • Details on how to reproduce the trouble, if available:

When trying to connect to the pritunl web interface I get a HTTP Error 502. I'm using the traefik reverse proxy config without wireguard. The config file is almost identical to the one you have stored under the example configs. Used to work fine a few months ago, and I can still connect to the set up pritunl vpn without any problems, just not the web interface.

Kiyam avatar Jul 13 '20 20:07 Kiyam

After running docker inspect pritunl, I noticed this under the "ports" section:

"Ports": {                       
    "1194/tcp": [                
        {                        
            "HostIp": "0.0.0.0", 
            "HostPort": "1194"   
        }                        
    ],                           
    "1194/udp": [                
        {                        
            "HostIp": "0.0.0.0", 
            "HostPort": "1194"   
        }                        
    ],                           
    "1195/udp": null,            
    "443/tcp": null,             
    "80/tcp": null,              
    "9700/tcp": null             
},                               

My guess would be something is causing the 9700/tcp to return null when it probably needs something?

Kiyam avatar Jul 13 '20 20:07 Kiyam

Can you provide your sanitized run command/docker-compose.yml?

goofball222 avatar Jul 16 '20 16:07 goofball222

version: "3.6"
services:

mongo:
    image: mongo:latest
    container_name: pritunldb
    hostname: pritunldb
    restart: always
    networks:
      - default
    volumes:
      - ${USERDIR}/docker/mongo/db:/data/db

  pritunl:
    image: goofball222/pritunl:latest
    container_name: pritunl
    hostname: pritunl
    restart: always
    privileged: true
    sysctls:
      - net.ipv6.conf.all.disable_ipv6=0
    networks:
      - default
      - traefik_proxy
    links:
      - mongo
    volumes:
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 1194:1194
      - 1194:1194/udp
    expose:
      - 9700
    environment:
      - TZ=${TZ}
      - MONGODB_URI=mongodb://mongo:27017/pritunl
      - REVERSE_PROXY=true
      # - WIREGUARD=false
    labels:
      - "traefik.enable=true"
      - "traefik.backend=pritunl"
      - "traefik.frontend.rule=Host:pritunl.${DOMAINNAME}"
      - "traefik.port=9700"
      - "traefik.docker.network=traefik_proxy"
      - "traefik.frontend.headers.SSLRedirect=true"
      - "traefik.frontend.headers.STSSeconds=315360000"
      - "traefik.frontend.headers.browserXSSFilter=true"
      - "traefik.frontend.headers.contentTypeNosniff=true"
      - "traefik.frontend.headers.forceSTSHeader=true"
      - "traefik.frontend.headers.SSLHost=${DOMAINNAME}"
      - "traefik.frontend.headers.STSIncludeSubdomains=true"
      - "traefik.frontend.headers.STSPreload=true"
      - "traefik.frontend.headers.frameDeny=true"

networks:
  traefik_proxy:
    external:
      name: traefik_proxy
  default:
    driver: bridge

Kiyam avatar Jul 16 '20 16:07 Kiyam

I was able to start a clean test instance of mongo and pritunl with your docker-compose and connect to the web interface via my 1.7 Traefik setup without error.

502 http status would typically indicate that traefik is having problems connecting to the pritunl container port 9700. Are there any errors in the pritunl or traefik Docker logs? Is the traefik_proxy network showing in docker network ls, and if you have any other traefik reverse-proxied services are they working?

goofball222 avatar Jul 16 '20 17:07 goofball222

Hmm oke. On my side, all of my other containers are working through traefik without any problems, things like netdata, portainer etc. On my Traefik dashboard the pritunl container is also registered with internal address of : http://172.18.0.9:9700

The docker networks show up with no problems, with the traefik_proxy network appearing in bridge mode. The pritunl logs look clean without any problems, and Traefik doesn't have any errors relating to pritunl.

It's extra odd because I'm still able to connect to the VPN server I have setup on pritunl, I just can't open the web interface.... Could it be something to do with my mongo db instance?

Kiyam avatar Jul 16 '20 18:07 Kiyam

@Kiyam I am having a similar issue although I am trying to use Wireguard but even when trying to just go without it I am also hitting the same problem you are seeing: server returned error: HTTP/1.1 502 Bad Gateway

The other difference is that I am just trying to start using this so I can't yet test if other ports are working but the web interface isn't.

I am using traefik 2.3 and all other services behind the reverse proxy work just fine.

here is my issue, please have a look maybe you can spot something? Since we are both having a very similar problem I think we are either both making the same mistake or hitting the same problem with this docker image :-(

https://github.com/goofball222/pritunl/issues/9

ovizii avatar Jul 28 '20 13:07 ovizii