从本地主机调用进行测试时,有没有办法让 https 请求工作 [英] Is there a way to get https requests to work when calling from a localhost for testing

查看:22
本文介绍了从本地主机调用进行测试时,有没有办法让 https 请求工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我切换到 https 后,我在本地测试我的应用程序时遇到错误:

I'm getting the errors when testing my application locally since I switched to https:

警告:域 www.example.com 未指定元策略.

Warning: Domain www.example.com does not specify a meta-policy.

应用默认元策略仅主控".这个配置是已弃用.请参阅 http://www.adobe.com/go/strict_policy_files 进行修复这个问题.

Applying default meta-policy 'master-only'. This configuration is deprecated. See http://www.adobe.com/go/strict_policy_files to fix this problem.

错误:请求资源在https://www.example.com/?json=user/get_logged_in_user 来自请求者来自 http://localhost:8888/Test-debug/Test.swf 被拒绝由于缺少策略文件权限.

Error: Request for resource at https://www.example.com/?json=user/get_logged_in_user by requestor from http://localhost:8888/Test-debug/Test.swf is denied due to lack of policy file permissions.

我尝试将本地主机更改为 https 但出现以下错误:

I tried changing my localhost to https but got the following error:

安全连接失败

连接到 localhost:8888 时出错.已收到 SSL超过最大允许长度的记录.错误代码:SSL_ERROR_RX_RECORD_TOO_LONG

An error occurred during a connection to localhost:8888. SSL received a record that exceeded the maximum permissible length. Error code: SSL_ERROR_RX_RECORD_TOO_LONG

无法显示您尝试查看的页面,因为无法验证接收到的数据的真实性.请联系网站所有者以告知他们此问题.

The page you are trying to view cannot be shown because the authenticity of the received data could not be verified. Please contact the website owners to inform them of this problem.

根据我所读到的内容,我可以上传并添加一个策略文件并将安全更改为 true,但我不想允许来自任何地方的呼叫.一旦 swf 在我的服务器上,一切正常.

From what I've read I can upload and add a policy file and changing secure to true but I don't want to allow calls from anywhere. Once the swf is on my server everything works fine.

有没有办法让它在本地工作以进行测试?有什么我可以在测试时启用的东西,比如:

Is there a way to get this to work locally for testing? Is there something that I can enable while testing like:

Security.allowDomain("localhost");

或者我是否必须上传跨域策略,然后在我完成测试后删除该策略?

Or do I have to upload a cross domain policy and then delete that policy when I'm done testing?

由于我的本地站点在浏览器中本地运行,它不应该能够连接到 https 连接吗?

Since my local site is running locally in the browser shouldn't it be able to make a connection to a https connection?

推荐答案

使用 https(顺便说一句,它没有根据您发布的消息正确配置(您是否使用 FireFox 进行测试?))将无济于事.问题是 www.example.com 没有 crossdomain.xml 策略文件,因此 Flash Player 不允许从您的 localhots这也是一个域.

Using of https (btw it does not configured properly according to message you posted (did you use FireFox to test?)) will not help. The problem is that www.example.com does not have crossdomain.xml policy file, so flash player does not allow to access that domain from your localhots which is also a domain.

如果您有权访问 www.example.com,请在此处添加具有通配符访问权限的策略文件,如果没有,则只能使用某些 http 代理进行模拟响应,才能通过 http 进行测试.

If you have an access to www.example.com add policy file here with wildcard access, if not - test via http is possible only with mocking response with some http proxy.

这篇关于从本地主机调用进行测试时,有没有办法让 https 请求工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆