我有一个本地开发框,它设置了 apache2 和包罗万象的通配符子域、dnsmasq 和一个本地网站。此设置便于使用多个浏览器进行测试,因为本地站点上的 Web 应用程序不允许多个浏览器从同一位置/域登录。该系统运行良好,除非我尝试测试 iframe 并在 iframe src url 中使用通配符子域。之后我得到一个找不到页面的错误。
从您可以在此页面底部查看的错误消息中包含的 URL 可以明显看出,游戏中虚拟主机的 apache 配置文件与 jsgame 中的重定向之间可能存在一些冲突,但我不知所措在如何解决它。谁能建议如何解决这个问题?
操作系统是 Debian 6,这就是我的系统的设置方式。
阿帕奇
在 etc/apache2/sites-available/game 内
<VirtualHost *:80>
ServerName catchall.game
ServerAlias *.game
VirtualDocumentRoot /var/www/%1
</VirtualHost>
#
<VirtualHost *:80>
ServerName mplayer.game
ServerAlias *.game
DocumentRoot /var/www/game/public
</VirtualHost>
网站
在 etc/apache2/sites_available/jsgame 内
Alias /jsgame/ usr/share/jsgame
RedirectMatch ^/jsgame/?$ /jsgame/example/index.html
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /JSGAME_REST http://127.0.0.1:19384/JSGAME_REST retry=1
ProxyPass /AVATAR http://127.0.0.1:19384/AVATAR retry=1
ProxyPass /UPLOAD http://127.0.0.1:19384/UPLOAD retry=1
dnsmasq
etc/dnsmasq.conf 中的第 62 行
# Add domains which you want to force to an IP address here.
# The example below send any host in doubleclick.net to a local
# webserver.
address=/.game/127.0.0.1
索引.html
通过以下方式访问 Web 应用程序:
master.game/jsgame/example/index.html?game_id=45
框架
/jsgame/example/index.html 中的 iframe 代码
<iframe id="player0" width="25%" height="25%" src="player0.game/jsgame/pts1.html" style="position:absolute;left:0px;top:0"></iframe>
我从 iframe 收到此错误:
在此服务器上未找到请求的 URL /jsgame/example/player0.game/pts1.html。
我预计 URL 将是:
player0.game/example/pts1.html 不是如上所示。