rspamd/rspamd.com

Fix broken docs about webui proxy

Opened this issue · 0 comments

Hi,
I tried to add my rspamd webui to my apache webserver via proxy as described in https://github.com/rspamd/rspamd.com/blob/master/doc/faq.md#how-to-use-the-webui-behind-a-proxy-server, but after several fails I realized that the docs are wrong here.

First of all the minor problem: I suggest do replace the Location block in apache config:

<Location /rspamd>
	Order allow,deny
	Allow from all
</Location>

with a version that works for apache2 as well as with the newer ones, because the current faq entry doesn't reflect the new syntax:

<Location /rspamd>
 <IfVersion >= 2.3>
      Require all granted
  </IfVersion>
  <IfVersion < 2.3>
      Order allow,deny
      Allow from all
  </IfVersion>
</Location>

Sadly, for the second problem I don't have a fix at hand, because I'm not sure if this is fixable by docs or must fixed in the code.
Currently, the docs say

RewriteRule ^/rspamd$ /rspamd/ [R,L]
RewriteRule ^/rspamd/(.*) http://localhost:11334/$1 [P,L]

Problem is, that this doesn't work for the webui. The main page does indeed get loaded, but all referrals (like the logo image, the css stylesheets etc) are broken. I think this is because (for example) the logo is referenced in the code as
<img src="./img/rspamd_logo_navbar.png" alt="Rspamd">
Because of the ./ in the beginning of the URI, the browser tries to open https://hostname.domain.tld/img/rspamd_logo_navbar.png instead of https://hostname.domain.tld/rspamd/img/rspamd_logo_navbar.png, which makes the webui unusable.

Also, using proxy is also available for apache, e.g.

	ProxyPass "http://localhost:11334/"
	ProxyPassReverse "http://localhost:11334/"

but this also fails due to the above mentioned URL problem. Currently, the only solution is to place the webui proxy into a separate <VirtualHost> container where you can omit the /rspamd location.

I hope it's clear what I'm trying to report, if not, don't hesitate to ask for more input :)

Frank