Community discussions

MUM Europe 2020
 
MisterFTTH
just joined
Topic Author
Posts: 2
Joined: Sat Mar 30, 2019 1:18 am

ROS WebUI behind Apache reverse proxy

Sun Apr 14, 2019 5:16 pm

Hi guys,

got my first MT router few weeks ago, among other things I'm trying to "reverse proxy" the ROS WebUI via an Apache server running inside my LAN in order to keep standard HTTP/S ports free for NAT, have a neat public URL, manage TLS certificates with ease.

Using simple standard config...

<VirtualHost *:80>

 ServerName ***
 RedirectMatch permanent ^(.*)$ https://***$1

 ErrorLog ${APACHE_LOG_DIR}/router_error.log
 CustomLog ${APACHE_LOG_DIR}/router_access.log combined

</VirtualHost>

<VirtualHost *:443>

 ServerName ***

 ProxyRequests off
 ProxyPreserveHost On

 ProxyPass / http://192.168.2.1:8080/
 ProxyPassReverse / http://192.168.2.1:8080/

 SSLEngine on

 SSLCertificateFile       /etc/letsencrypt/live/***/cert.pem
 SSLCertificateKeyFile /etc/letsencrypt/live/***/privkey.pem
 SSLCACertificateFile  /etc/letsencrypt/live/***/chain.pem

 ErrorLog ${APACHE_LOG_DIR}/router_error.log
 CustomLog ${APACHE_LOG_DIR}/router_access.log combined

</VirtualHost>

...results in a spoiled behavior as you can see from following animated GIF (click on thumbnail):
Image
Via direct LAN connection (http://<gtw IP>:<port>) runs smoothly, of course.

Well I ain't no Apache nerd (you don't say!) but I'm quite sure config needs improvements...maybe rewrite rules? Or some code lines about web socket?
Any idea? Thanks in advance!
 
MisterFTTH
just joined
Topic Author
Posts: 2
Joined: Sat Mar 30, 2019 1:18 am

Re: ROS WebUI behind Apache reverse proxy

Sun Apr 21, 2019 4:37 pm

nobody have hints? :cry:
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: ROS WebUI behind Apache reverse proxy

Sun Apr 21, 2019 5:48 pm

Have a look at Chrome's developer tools (F12), and more specifically the network tab.

Compare what you see there with what you'll get if you open up the router directly. This will give you a hint as to what may be going on.

I would guess that what's happening is that RouterOS is producting full links, rather than relative ones. But that's just pure speculation.

Also, if you're just going to use the web server for a reverse proxy, maybe consider using Nginx instead of Apache?
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
tajniak
just joined
Posts: 1
Joined: Sat Nov 30, 2019 8:27 pm

Re: ROS WebUI behind Apache reverse proxy

Sat Nov 30, 2019 8:34 pm

# enable mod_substitute.so, mod_proxy.so and mod_proxy_http.so

<Location /router/ >
ProxyPass http://192.168.88.1/
ProxyPassReverse http://192.168.88.1/
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|/graph\.|/router/graph\.|i"
Substitute "s|\"/graphs\"|\"/router/graphs/\"|i"
Substitute "s|/help/|/router/help/|i"
Substitute "s|/favicon.png|/router/favicon.png|i"
</Location>

ProxyPass /webfig http://192.168.88.1/webfig
ProxyPassReverse /webfig http://192.168.88.1/webfig
ProxyPass /jsproxy http://192.168.88.1/jsproxy
ProxyPassReverse /jsproxy http://192.168.88.1/jsproxy

Who is online

Users browsing this forum: MSN [Bot] and 82 guests