通过nginx的代理网站结果为空白页
问题描述:
我们使用Wix.com开发了我们网站的新版本。由于我们在iOS上使用深度链接,因此我们需要place a text file in the website root。原来Wix目前不支持这个,虽然他们是considering it。通过nginx的代理网站结果为空白页
“没问题”,我们认为。我们可以使用nginx反向代理来提供apple-app-site-association
文件,并将其余流量代理到Wix。我们设置这个了以下nginx的配置:
upstream wix {
keepalive 100;
server mgertner.wixsite.com:443;
}
server {
listen 80;
server_name getcorkscrew.com;
location/{
proxy_http_version 1.1;
proxy_pass https://wix/corkscrew-copy;
proxy_pass_request_headers on;
}
}
server {
listen 80;
server_name www.getcorkscrew.com;
location/{
proxy_http_version 1.1;
proxy_pass https://mgertner.wixsite.com/corkscrew-copy;
proxy_pass_request_headers on;
}
}
然而,当我们去www.getcorkscrew.com,我们只是得到一个空白页回来。显然,页面是由维克斯返回,和head
,包含了一些脚本和其他东西,但身体只包含:
<body>
<div id="SITE_CONTAINER"></div>
<div comp="wysiwyg.viewer.components.WixAds" skin="wysiwyg.viewer.skins.wixadsskins.WixAdsWebSkin" id="wixFooter"></div>
<script type="text/javascript">window.NREUM||(NREUM={});NREUM.info={"errorBeacon":"bam.nr-data.net","licenseKey":"c99d7f1ab0","agent":"","beacon":"bam.nr-data.net","applicationTime":9,"applicationID":"1963269,30200700","transactionName":"ZFAHNkNYXUBQVEUKXF0aNgdDT19WRRhVCkBDVBEBWVxB","queueTime":0}
</script>
</body>
看来,维克斯以某种方式检测用户使用代理,以及阻断正常页面内容。但是当我们检查这个时,我们发送与原始请求完全相同的标题。
关于Wix如何知道我们使用代理以及我们如何解决这个问题的任何想法?
答
原来这是Wix呈现网站的具体方式。他们将网站的网址嵌入其index.html
,并且如果网站是从其他网址加载的,则该网站不会呈现。我不认为他们故意阻止了这一点。对我来说,它看起来像渲染代码的实现副作用。
我们通过使用nginx子过滤器将index.html
中嵌入的URL更改为我们正在代理的URL来解决此问题。现在它工作正常。
嗨。刚刚通过Google找到您的回复。我还添加了一个sub_filter'sub_filter“wixdomain.wixsite.com”“$ host”;''和'sub_filter_once off;'但该网站仍然不呈现并且是白色的。你使用了什么sub_filter? – Musterknabe
您是否检查了'publicModel'的值在subfiltered'index.html'中?在我看来,至少你需要在过滤器源代码中包含站点名称(即'wixdomain.wixsite.com/sitename')。 –
你的意思是在源代码内的'publicModel' json?它已经是“正确的”,'var publicModel = {“domain”:“wixsite.com”,“externalBaseUrl”:“http:\/\/localhost:8081 \/compliance”,“unicodeExternalBaseUrl”:“http:\/\/localhost:8081 \/compliance“' 或者我们在谈论不同的事情? – Musterknabe