My Tomato router supports dnsmasq, allowing me to provide user friendly names in place of IP addresses for the web services on my local LAN. Simply adding the following to the dnsmasq Custom Configuration field in the router settings creates addresses pointing to my start page and the staging/development versions of my company website and personal blog hosted on the NAS:

address=/portal.lan/192.168.1.252
address=/rassd.lan/192.168.1.252
address=/blog.lan/192.168.1.252

However dnsmasq only supports the standard HTTP port 80. This poses a problem for some other services, for example my Docker containers on the Synology NAS use non-standard ports. To get round this I need to use virtual hosts in Apache to port forward. Unortunately the Synology web server configuration doesn't support this. I decided to use the Apache instance on one of my Linux servers instead, essentially using it as a proxy to the NAS. An example configuration for the GitLab container:

<VirtualHost *:80>
    ServerName gitlab.lan
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Location />
              Order allow,deny
              Allow from all
              Require all granted
    </Location>
    ProxyPreserveHost On
    ProxyPass / http://192.168.1.252:30000/
    ProxyPassReverse / http://192.168.1.252:30000/
</VirtualHost>

Here the container's port 3000 is forwarded from the gitlab.lan address on port 80 of the Linux server. Thus I can finish my dnsmasq configuration on the router with the remaining services, now forwarded from the Linux box:

Previous Post Next Post