我有一个企业专用网络(VPN),在一个虚拟机上托管一个只能在内部访问的网站。例如https://internal.com/welcome.html
现在,我想允许从外面访问网站的几个页面,但使用自己的网址。
e.g。他们将打开http://theirdoamin.com/welcome.html,它将被重定向到我的私人网络,并在内部将其映射/代理到https://internal.com/welcome.html。
这种方式外面永远不会知道实际的网址(即https://internal.com/welcome.html。
我的问题是,我们可以使用位于托管虚拟机前面的Apache Reverse代理服务器来实现这一目标吗?
第二个问题,我是否也可以仅限制访问welcome.html页面而不限制其他页面?
我的同事已经使用Apache Nifi实现了,但我仍然认为使用Apache Reverse Proxy设置可以很简单。
请告知。
由于
答案 0 :(得分:0)
1)是的,Apache反向代理能够做到这一点。 2)您可以根据需要限制访问。
1)我设置了两个vhosts(用于examples),一个具有原始名称,另一个具有VPN可访问名称。
path
您需要RewriteRule来定位特定文件而不是整个域。否则,简单的<Router ... >
{ /* Your actual route declarations */ }
<Route component={ NoMatch } path="*" />
</Router>
就足够了。
这需要激活模块Listen 80
#If you are running a Apache 2.2 you'll need the following line, for 2.4 you won't
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "srv/www/example1"
ServerName internal.com
<Directory "/srv/www/example1">
Require all granted
</Directory>
# Other directives here, if needed
</VirtualHost>
<VirtualHost *:80>
ServerName external.com
ProxyPreserveHost On
RewriteEngine On
RewriteRule ^ https://internal.com/welcome.html [P]
ProxyPassReverse / https://internal.com/
</VirtualHost>
,ProxyPass
和mod_rewrite
。
2)由RewriteRule完成。它只允许访问该特定目标文件(welcome.html)。