In the local network, I have synology server with a number of services running in docker on different ports and accessible in-browser like that
192.168.1.2:8989
or server.spb.lan:8989
How to make a rewrite rule to convert them like that 192.168.1.2/servicename
or server.spb.lan/servicename
?
Like that
192.168.1.2:8989 -> 192.168.1.2/servicename
server.spb.lan:8989 -> server.spb.lan/servicename
3
Answers
I couldn't solve the issue with apache installed directly on Synology. So I deleted it, deleted web station. Then I install nginx in docker. Synology has integrated nginx running on port 80, which cannot be deleted and there is no access to its settings. So I just mapped internal port 80 of nginx container to port 82 on Synology, make forward port 80 from router to port 82 on Synology. And then in config of nginx container I did simply that for each of my app running in docker
Based on your shown samples, could you please try following. Please make sure you clear your browser cache after placing these rules in your htaccess file.
I assume, that those backend services operate based on the http protocol, since you did not specify anything else…
Easiest probably is to use the apache proxy module to expose those backend services. You can use it within the rewriting module which makes the approach pretty convenient:
An alternative to the rewriting module would be to implement a reverse proxy:
I suggest you read about the details in the apache documentation. As typical for OpenSource it is of excellent quality and comes with great examples.