UpSource Apache VirtualHost Configuration

I'm attempting to use UpSource behind an Apache reverse proxy on the same machine and the frontend keeps restarting, I think this comes down to an issue with my VirtualHost configuration but I can't seem to pinpoint it.  The VirtualHost configuration I'm using is at the bottom of this post and the configuration of the UpSource service is directly below (using review.example.com as the domain with HTTPS on the outside.)  This works when I remove the VirtualHost and set UpSource to use HTTP:

./bin/upsource.sh configure --listen-port 1111 --base-url http://127.0.0.1:1111

<VirtualHost EXTERNAL_IP_ADDRESS:80>
        ServerName              review.example.com

        DocumentRoot            /var/www/vhosts/example.com/review

        RewriteEngine on
        RewriteCond             %{SERVER_PORT}                          80
        RewriteRule             ^(.*)$                                  https://review.example.com$1    [R,L]
</VirtualHost>

<VirtualHost EXTERNAL_IP_ADDRESS:443>
        ServerName              review.example.com

        DocumentRoot            /var/www/vhosts/example.com/review

        <IfModule mod_ssl.c>
                SSLEngine                       On

                SSLCertificateFile              /etc/letsencrypt/live/review.example.com/cert.pem
                SSLCertificateKeyFile           /etc/letsencrypt/live/review.example.com/privkey.pem
        </IfModule>


        ProxyRequests           Off
        ProxyPass               /~socket.io/                            ws://127.0.0.1:1111/~socket.io/                         connectiontimeout=240   timeout=1200
        ProxyPassReverse        /~socket.io/                            ws://127.0.0.1:1111/~socket.io/

        ProxyPass               /                                       http://127.0.0.1:1111/
        ProxyPassReverse        /                                       http://127.0.0.1:1111/

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/review.example.com/chain.pem
</VirtualHost>

3 comments
Comment actions Permalink

It seems to be a bit closer with the configuration below - but seems to still fail with:

Backend is not available
TypeError: NetworkError when attempting to fetch resource.
 
When I press F12 it looks like it's because the site is requesting something from http://review.example.com:1111/hub/api/rest/settings/public?fields=id in spite of the below configuration.  Any ideas?

./bin/upsource.sh configure --listen-port 1111 --base-url https://review.example.com

and the virtualhosts:

<VirtualHost EXTERNAL_IP_ADDRESS:80>
        ServerName              review.example.com

        DocumentRoot            /var/www/vhosts/example.com/review

        RewriteEngine on
        AllowEncodedSlashes on

        RewriteCond             %{SERVER_PORT}                          80
        RewriteRule             ^(.*)$                                  https://review.example.com$1    [R,L]
</VirtualHost>

<VirtualHost EXTERNAL_IP_ADDRESS:443>
        ServerName              review.example.com

        DocumentRoot            /var/www/vhosts/example.com/review

        <IfModule mod_ssl.c>
                SSLEngine                       On

                SSLCertificateFile              /etc/letsencrypt/live/review.example.com/cert.pem
                SSLCertificateKeyFile           /etc/letsencrypt/live/review.example.com/privkey.pem
        </IfModule>

        DefaultType             none

        RewriteEngine           On
        AllowEncodedSlashes     On

        RewriteCond             %{QUERY_STRING}                         transport=polling
        RewriteRule             /(.*)$                                  http://127.0.0.1:1111/$1                [P]

        ProxyRequests           Off
        ProxyPreserveHost       On
        ProxyPass               /~socket.io/                            ws://127.0.0.1:1111/~socket.io/         connectiontimeout=240   timeout=1200
        ProxyPassReverse        /~socket.io/                            ws://127.0.0.1:1111/~socket.io/

        ProxyPass               /                                       http://127.0.0.1:1111/
        ProxyPassReverse        /                                       http://127.0.0.1:1111/

        RequestHeader set X-Forwarded-Port "443"
        RequestHeader set X-Forwarded-Proto "https"

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/review.example.com/chain.pem
</VirtualHost>

0
Comment actions Permalink

Try doing this:

./bin/upsource.sh configure --listen-port 1111 --base-url https://review.example.com:443

0
Comment actions Permalink

This might work but I can't test it because my environment changed too much since the initial post.  I ended up solving it by using a dedicated Hub installation and pointing UpSource at that.

0

Please sign in to leave a comment.