Origam with a reverse proxy redirecting to wrong site

I have an Origam application running on a server (Debian) listening on the port 8080. To make it accessible via HTTPS, I set up an Apache server, which otherwise uses the ports 80 and 443 for the purposes of different site, to listen on the port 5000 expecting HTTPS connection and reverse proxy the requests to HTTP at 8080 where the Origam is listening. It works but when I open the HTTPS website on the port 5000 in my browser (Firefox), the Origam login page opens and I’m redirected to HTTP and port 8080. What could cause this problem and how to solve it?

My .env file:

gitPullOnStart=false
OrigamSettings_SetOnStart=true
OrigamSettings_SchemaExtensionGuid=cc16051e-fc8f-403a-970a-7a2fa65457b8
OrigamSettings_DbHost=***
OrigamSettings_DbPort=5433
OrigamSettings_DbUsername=***
OrigamSettings_DbPassword=***
DatabaseName=***
OrigamSettings_ModelName=origam
DatabaseType=postgresql
ExternalDomain_SetOnStart=https://inspiring-schools.org:5000

The bash script I’m using to start the Origam application:

sudo docker run --env-file /home/debian/MapOfSchools/NewProject/mapofschools-server.env -it -v /home/debian/MapOfSchools:/home/origam/HTML5/data/origam -p 8080:8080 origam/server:2021.1.0.2254

The part of my Apache configuration for the 5000 port:

<VirtualHost *:5000>
        ServerName inspiring-schools.org
        ServerAdmin admin@inovativnivzdelavani.cz
        DocumentRoot /var/www/mapofschools
        ProxyPass / http://inspiring-schools.org:8080/

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        SSLEngine on
        SSLCertificateFile /etc/letsencrypt/live/inspiring-schools.org/fullchai$
        SSLCertificateKeyFile /etc/letsencrypt/live/inspiring-schools.org/privk$
</VirtualHost>

Try to add parameter .ProxyPassReverse

ProxyPassReverse / http://inspiring-schools.org:8080/

I also needed to add

RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
ProxyPreserveHost On

But then it worked

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.