SOLVED Reverse Proxy for UI

Katagia

Dabbler
Joined
Sep 7, 2019
Messages
12
Hello

I tried to access the user interface behinder an apache reverse proxy.
I didn't find an easy solution because the new UI uses websocket.

The following solution works for me:
<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>

The ProxyPass part was easy to go. I needed a while to find the correct rewrite rules.

Maybe this can help others.
 
Last edited:

durfejs

Cadet
Joined
Feb 26, 2021
Messages
3
I have done following:

ServerName myserver

<IfModule mod_proxy.c>

RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://192.168.1.100/$1 [P,L]
ProxyPass / http://192.168.1.100/
ProxyPassReverse / http://192.168.1.100/
</IfModule>

but does not work either
 

Katagia

Dabbler
Joined
Sep 7, 2019
Messages
12
You missed the quotes in the ProxyPass sections.
is mod_proxy loaded?
Are you using apache2 like me?

Do you see any errors in your apache config?
Can you see that the requests are redirected?
Can you see the incoming requests to Freenas/truenas in tcpdump?

I've checked my config and it is working.
 

durfejs

Cadet
Joined
Feb 26, 2021
Messages
3
You missed the quotes in the ProxyPass sections.
is mod_proxy loaded?
Are you using apache2 like me?

Do you see any errors in your apache config?
Can you see that the requests are redirected?
Can you see the incoming requests to Freenas/truenas in tcpdump?

I've checked my config and it is working.

Now I have this:
ServerName myserver

<IfModule mod_proxy.c>

RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://192.168.1.100/$1 [P,L]
ProxyPass "/" "http://192.168.1.100/"
ProxyPassReverse "/" "http://192.168.1.100/"
</IfModule>

You missed the quotes in the ProxyPass sections. - corrected
is mod_proxy loaded?

Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
headers_module (shared)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
php7_module (shared)
proxy_module (shared)
proxy_http_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
setenvif_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
status_module (shared)

Are you using apache2 like me?

Yes

Do you see any errors in your apache config?

# apache2ctl configtest
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK

Can you see that the requests are redirected? How do I check?

Can you see the incoming requests to Freenas/truenas in tcpdump? How do I check?

Thank you
 
Last edited:

Katagia

Dabbler
Joined
Sep 7, 2019
Messages
12
Your posting is very difficult to read due to the way how it's formated.

You should increase Apaches loglevel to monitor what's going on.

You can use tcpdump in Freenas, tcp, Port 80 to monitor requests.

What exactly is not working?

I'm not sure but maybe you have to enable something to make websockets work.
 
Top