Score:0

Web UI is loading when configuring Archiva behind Reverse Proxy

bw flag

I have setup both archiva and httpd on Ubuntu 22.04 for testing.

Apache Archiva version: 2.2.9
Apache HTTP Server: 2.4.52

The VirtualHost configuration:

<VirtualHost _default_:443>
    ProxyPass "/test/" "http://192.168.1.1:8080/"
    ProxyPassReverse "/test/" "http://192.168.1.1:8080/"
</VirtualHost>

HTTP Server URL: https://my.example.com/test/
Archiva Server URL: http://192.168.1.1:8080/

When using Firefox to open the http://192.168.1.1:8080/ directly, then the whole Archiva UI can show up normally.

When using Firefox to open the https://my.example.com/test/, Firefox can show the title as "Apache Archiva" but the Web Content not showing up, it only shows the "Loading"...

enter image description here

What's missing in the VirtualHost for making the Archiva to work with Reverse Proxy?

Update: Here is the view source from Firefox:

view-source:https://my.example.com/test/

<html>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="css/jquery.fileupload-ui.css"/>
    <link rel="stylesheet" href="css/jqueryFileTree.css"/>
    <link rel="stylesheet" href="css/jquery-ui-1.9.2.custom.min.css"/>
    <link rel="stylesheet" href="css/select2-3.2.css"/>
    <link rel="stylesheet" href="css/typeahead.js-bootstrap.0.9.3.css"/>
    <link rel="stylesheet" href="css/bootstrap.2.2.2.css">
    <link rel="stylesheet" href="css/archiva.css">
    <link rel="shortcut icon" href="favicon.ico"/>
    <link rel="stylesheet" href="css/prettify.css"/>

    <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.10.4.min.js"></script>
    <script type="text/javascript" src="js/sammy.0.7.4.js"></script>
    <script type="text/javascript" data-main="js/archiva/archiva.js" src="js/require.min.2.1.11.js"></script>

    <title>Apache Archiva</title>

  </head>
...

view-source:https://my.example.com/test/js/archiva/archiva.js

requirejs(['jquery','jquery.tmpl','jquery.ui','i18n','sammy','startup','utils','domReady!','archiva.main','archiva.cookie-information'], function () {
        loadi18n(function () {
          $.ajax({
            url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(),
            dataType: 'json',
            success:function(data){
              window.archivaDevMode=data.devMode;
              window.archivaJavascriptLog=data.javascriptLog;
              window.archivaRuntimeInfo=data;

              window.cookieInformation=mapCookieInformation(data.cookieInformation);

              require(['sammy','jquery','jquery.ui','i18n','jquery.tmpl','archiva.main','utils','domReady!'],function () {
                  startArchivaApplication();
                  $("#loadingDiv").hide();
                  drawQuickSearchAutocomplete();
              })
            }
          })
        });
      });  


  

From the view source, Firefox can get the correct html content from Archiva 8080 server, but it can't activate the js function "loadi18n", the "$("#loadingDiv").hide();" is not executed at all.

The "js/archiva/archiva.js" in Archiva can't work as expected in reverse proxy mode for unknown reason.

Robin Hood avatar
no flag
i think you are usinh `https` when you are accessing your web with `https://my.example.com/test/` Are you sure you have `SSL` configuration locally? else try with `http://my.example.com/test/`
stackbiz avatar
bw flag
Thank you so much, I tried to disable the https mode in reverse proxy, then the http works on archiva. But I don't understand why https is not working on Archiva. And if I enable both the "https" and "http" mode in reverse proxy mode, when accessing the "http://" mode it will convert to "https" automatically, I also don't know why this happens.
Score:0
no flag
Listen 8080

<VirtualHost *:8080>
        ServerName my.example.com/test/

        SSLEngine On
        SSLCertificateFile    /path/to/apache_certs/cert.pem
        SSLCertificateKeyFile /path/to/apache_certs/cert.key

        ProxyRequests     Off
        ProxyPass         /  http://localhost:8080/
        ProxyPassReverse  /  http://localhost:8080/
        <Proxy http://localhost:8080/*>
                Order allow,deny
                Allow from all
        </Proxy>
        ProxyPreserveHost on
</VirtualHost>

Run this command to configure two apache mods

sudo a2enmod proxy proxy_http

Source

stackbiz avatar
bw flag
Thank you, Its the same loading. I found a link says change the Origin header but that link is not using apache2: `http-request set-header Origin http://%[hdr(host)]/`, Do you know how to implement the same thing in apache2? Here is the link: https://wasteofserver.com/apache-archiva-behind-haproxy-with-ssl-termination/
Robin Hood avatar
no flag
Check this one https://linuxhostsupport.com/blog/how-to-install-and-configure-haproxy-on-ubuntu-20-04/
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.