dodona-edu / dolos

:detective: Source code plagiarism detection
https://dolos.ugent.be
MIT License
244 stars 31 forks source link

Fix hosting Dolos publicly on https using docker-compose #1522

Closed rien closed 3 months ago

rien commented 3 months ago

If Dolos is hosted publicly behind a reverse proxy, Rails does not appropriately detect that HTTPS should be used for urls generated by the API, causing the front-end to fetch the CSV files using http instead of https (see #1518).

This PR fixes this issue by introducing a new environment variable DOLOS_API_URL which is used to detect the hosting properties. It supersedes the environment variables DOLOS_API_HOSTS and DOLOS_API_DISABLE_FORCE_SSL.

Unfortunately there is a bug in rails where files served using ActiveStorage don't listen to the relative_root_url (https://github.com/rails/rails/issues/43633). This can cause issues if the API is hosted on a subdirectory (https://example.com/api).

See https://github.com/dodona-edu/dolos/issues/1523 for more details and a workaround.