DOMjudge / domjudge-packaging

DOMjudge packaging for (Linux) distributions and live image
31 stars 37 forks source link

No possibility to change BASE URL of WEB app #59

Closed imwexpex closed 4 years ago

imwexpex commented 4 years ago

Hey! It would be nice if you could add some Enviroment BASE_URL to docker run, because of now there is no possibility to change localhost URL

nickygerritsen commented 4 years ago

Do we use the base url somewhere? Or what is the reason you want to change it?

imwexpex commented 4 years ago

Yep, as i see you use it at least for auth redirection.

try to login here with some bad creds: https://domjudge.digitalsheva.app/login

nickygerritsen commented 4 years ago

How have you set up the Docker container? I just tried setting it up using the default command and then adding an nginx proxy in front of it at https://dj.thuis.xept.nl/login . For me it doesn't redirect to localhost but to the site. My nginx proxy has no special config btw...

imwexpex commented 4 years ago

Just follow the instructions at https://hub.docker.com/r/domjudge/judgehost/ no special configuration included, all by default.

Also proxying with Nginx to localhost:12345 w/o special configuration.

Maybe it would be better if I will share some configs which will help you to find a problem?

nickygerritsen commented 4 years ago

Yes please, since I basically did the same and it worked.

imwexpex commented 4 years ago

What can I share that will help you?

nickygerritsen commented 4 years ago
imwexpex commented 4 years ago

OS: Ubuntu 16.4 Nginx Conf: https://pastebin.com/yZT2ngQ0

Default copy-paste command, nothing else.

docker run -v /sys/fs/cgroup:/sys/fs/cgroup:ro --link dj-mariadb:mariadb -it -e MYSQL_HOST=mariadb -e MYSQL_USER=user-e MYSQL_DATABASE=db -e MYSQL_PASSWORD=psswd -e MYSQL_ROOT_PASSWORD=rootpwd -p 12345:80 --name domserver domjudge/domserver:latest

nickygerritsen commented 4 years ago

I am lost... I checked my config and it is exactly the same...

What you can try is to set this in your location block, maybe it helps:

        proxy_set_header  Host              $http_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;

Although I don't have these settings and it works for me. The only difference is that I am using Ubuntu 20.04 but I can't imagine that really being different.

imwexpex commented 4 years ago

Hi! Sorry for the delayed answer! Setting just proxy_set_header Host $http_host; Helps!

nickygerritsen commented 4 years ago

Great! I will close the issue then. I will update the Docker readme at some point to add this there.