iframes无法使用通配符catchall子域和dnsmasq

iframes wont work with wildcard catchall sub-domains and dnsmasq

本文关键字:dnsmasq catchall 通配符 iframes      更新时间:2023-09-26

我有一个本地开发框,它是用apache2和catchall通配符子域、dnsmasq和一个本地网站设置的。此设置便于使用多个浏览器进行测试,因为本地网站上的web应用程序不允许多个浏览器从同一位置/域登录。这个系统运行良好,除了我尝试测试iframes和在iframes-src-url中使用通配符子域时。之后我得到一个页面未找到错误。

从这个页面底部的错误消息中包含的URL可以明显看出,游戏中虚拟主机的apache配置文件和jsgame中的重定向之间似乎存在一些冲突,但我不知道如何解决它。有人能建议如何解决这个问题吗?

操作系统是Debian 6,这就是我的系统设置方式。

Apache

etc/apache2/可用站点/游戏

<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/dnsmassq.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

index.html

web应用程序可通过以下方式访问:

master.game/jsgame/example/index.html?game_id=45

iframe

/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与上面显示的不同。

如果使用http://player0.game/jsgame/pts1.html而不是player0.game/jsgame/pts1.html作为iframe的src属性,该怎么办?

<iframe 
   id="player0" 
   width="25%" 
   height="25%" 
   src="http://player0.game/jsgame/pts1.html" 
   style="position:absolute;left:0px;top:0">
</iframe>

这将避免被认为是相对的。