使用反向代理 ('Unknown Source') 在 Web 浏览器上阻止已签名的小程序
signed applet blocked on webbrowser with reverse Proxy ('Unknown Source')
我在新网络服务器上部署签名小程序(来自受信任 CA 的证书)时遇到问题。它在我的旧网络服务器上 运行 没问题,但是当我将它转移到新主机时,它被 Java 安全设置阻止。
我在我的 html 文件中这样部署它:
<div id="applet">
<script>
var attributes = {codebase:'http://ab123.wwwdns.example.com/Applet/',
code: 'db.main.ExApplet',
archive: 'ExampleApplet.jar',
width: '1150',
height: '700',
permissions: 'sandbox'};
var parameters = {};
var version = '1.6';
deployJava.runApplet(attributes, parameters, version);
</script>
</div>
我的 MANIFEST 文件包含以下几行:
Manifest-Version: 1.0
Application-Name: Example Name
Permissions: sandbox
Caller-Allowable-Codebase: *.example.com http://ab123.wwwdns.example.com http://other.example.com
Codebase: *.example.com http://ab123.wwwdns.example.com http://other.example.com
Application-Library-Allowable-Codebase: *.example.com http://ab123.wwwdns.example.com http://other.example.com
Entry-Point: db.main.ExApplet
(之前我尝试过只指定 *.example.com 但这也不起作用)
我想这个问题与现在可以通过两个不同的 URL(ab123.wwwdns.example.com 和 other.example.com)访问小程序有关吗?
以下是 Java 控制台的摘录(Java Firefox 上的 8 Update 71 build 15 插件):
java.lang.reflect.InvocationTargetException
...
Caused by: com.sun.deploy.security.BlockedException: Your security settings have blocked an untrusted application from running
at com.sun.deploy.security.BlockedDialog.show(Unknown Source)
at com.sun.deploy.security.SandboxSecurity.checkRunUntrusted(Unknown Source)
at
com.sun.deploy.security.SandboxSecurity.checkUnsignedSandboxSecurity(Unknown Source)
...
欢迎任何提示!
我终于解决了我的问题;我发现 'Unknown Source' 错误是因为找不到我使用的外部库。这很奇怪,因为我使用与在旧服务器上完全相同的架构来访问外部库,但在新服务器上由于某些(我不知道的)原因这不起作用。
这里列出了我在研究期间为使 Applet 正常工作所做的更改列表,现在它 运行 非常好,希望这能帮助其他在部署 applet 时遇到问题的人:
- 我从 html 文件中删除了代码库属性
- 我在 MANIFEST 文件中使用了通配符 *.example.com
- 我将所有外部库移动到与 ExampleApplet.jar 相同的文件夹中,并且不再将它们添加到 ExampleApplet.jar 文件中
- 以前我的 Class-Path 属性中有一个点 (.),我也删除了它
html 文件
<div id="applet">
<script>
var attributes = {code: 'db.main.ExApplet',
archive: 'ExampleApplet.jar',
width: '1150',
height: '700',
permissions: 'sandbox'};
var parameters = {};
var version = '1.6';
deployJava.runApplet(attributes, parameters, version);
</script>
</div>
清单文件
Manifest-Version: 1.0
Application-Name: Example Name
Permissions: sandbox
Caller-Allowable-Codebase: *.example.com
Codebase: *.example.com
Application-Library-Allowable-Codebase: *.example.com
Class-Path: external1.jar external2.jar
Entry-Point: db.main.ExApplet
(以前 Class-Path 看起来像这样,外部库位于 lib/ 下,另外在 ExampleApplet.jar 内):
Class-Path: . lib/external1.jar lib/external2.jar
我在新网络服务器上部署签名小程序(来自受信任 CA 的证书)时遇到问题。它在我的旧网络服务器上 运行 没问题,但是当我将它转移到新主机时,它被 Java 安全设置阻止。
我在我的 html 文件中这样部署它:
<div id="applet">
<script>
var attributes = {codebase:'http://ab123.wwwdns.example.com/Applet/',
code: 'db.main.ExApplet',
archive: 'ExampleApplet.jar',
width: '1150',
height: '700',
permissions: 'sandbox'};
var parameters = {};
var version = '1.6';
deployJava.runApplet(attributes, parameters, version);
</script>
</div>
我的 MANIFEST 文件包含以下几行:
Manifest-Version: 1.0
Application-Name: Example Name
Permissions: sandbox
Caller-Allowable-Codebase: *.example.com http://ab123.wwwdns.example.com http://other.example.com
Codebase: *.example.com http://ab123.wwwdns.example.com http://other.example.com
Application-Library-Allowable-Codebase: *.example.com http://ab123.wwwdns.example.com http://other.example.com
Entry-Point: db.main.ExApplet
(之前我尝试过只指定 *.example.com 但这也不起作用)
我想这个问题与现在可以通过两个不同的 URL(ab123.wwwdns.example.com 和 other.example.com)访问小程序有关吗?
以下是 Java 控制台的摘录(Java Firefox 上的 8 Update 71 build 15 插件):
java.lang.reflect.InvocationTargetException
...
Caused by: com.sun.deploy.security.BlockedException: Your security settings have blocked an untrusted application from running
at com.sun.deploy.security.BlockedDialog.show(Unknown Source)
at com.sun.deploy.security.SandboxSecurity.checkRunUntrusted(Unknown Source)
at
com.sun.deploy.security.SandboxSecurity.checkUnsignedSandboxSecurity(Unknown Source)
...
欢迎任何提示!
我终于解决了我的问题;我发现 'Unknown Source' 错误是因为找不到我使用的外部库。这很奇怪,因为我使用与在旧服务器上完全相同的架构来访问外部库,但在新服务器上由于某些(我不知道的)原因这不起作用。
这里列出了我在研究期间为使 Applet 正常工作所做的更改列表,现在它 运行 非常好,希望这能帮助其他在部署 applet 时遇到问题的人:
- 我从 html 文件中删除了代码库属性
- 我在 MANIFEST 文件中使用了通配符 *.example.com
- 我将所有外部库移动到与 ExampleApplet.jar 相同的文件夹中,并且不再将它们添加到 ExampleApplet.jar 文件中
- 以前我的 Class-Path 属性中有一个点 (.),我也删除了它
html 文件
<div id="applet">
<script>
var attributes = {code: 'db.main.ExApplet',
archive: 'ExampleApplet.jar',
width: '1150',
height: '700',
permissions: 'sandbox'};
var parameters = {};
var version = '1.6';
deployJava.runApplet(attributes, parameters, version);
</script>
</div>
清单文件
Manifest-Version: 1.0
Application-Name: Example Name
Permissions: sandbox
Caller-Allowable-Codebase: *.example.com
Codebase: *.example.com
Application-Library-Allowable-Codebase: *.example.com
Class-Path: external1.jar external2.jar
Entry-Point: db.main.ExApplet
(以前 Class-Path 看起来像这样,外部库位于 lib/ 下,另外在 ExampleApplet.jar 内):
Class-Path: . lib/external1.jar lib/external2.jar