Access TrueNas through a reverse proxy using Apache

RFR

Cadet
Joined
Aug 29, 2022
Messages
2
I have reviewed the post https://www.truenas.com/community/threads/reverse-proxy-for-ui.86873/ and I can get that to work.
<IfModule mod_proxy.c>
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://server-name/$1 [P,L]

ProxyPass "/" "http://server-name/"
ProxyPassReverse "/" "http://server-name/"
</IfModule>

This is fine but I would like to access TrueNas at "/nas/" rather than "/". Has anyone had success at doing this? I am guessing that TrueNas is using absolute paths for resources under /ui, but I am not sure how to resolve that in a reverse proxy.

What I am looking for would look something like below:

<IfModule mod_proxy.c>
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://server-name/$1 [P,L]

ProxyPass "/nas/" "http://server-name/"
ProxyPassReverse "/nas/" "http://server-name/"
</IfModule>

This does not work as TrueNas seems to be using absolute paths and looks for resources in http:/proxy.com/ui/some.css instead of http://proxy.com/nas/ui/some.css.
 

Nick2253

Wizard
Joined
Apr 21, 2014
Messages
1,633
This doesn't specifically answer your question, but due to problems like this, I've taken to using subdomains over paths. For example, nas.proxy.com instead of proxy.com/nas.
 

RFR

Cadet
Joined
Aug 29, 2022
Messages
2
I was thinking of that, but would like to figure out the issue.
 

Nick2253

Wizard
Joined
Apr 21, 2014
Messages
1,633
Top