简体   繁体   English

Tomcat 7 GWT应用SSL配置

[英]Tomcat 7 GWT app ssl configuration

I am working on gwt project which is hosted on tomcat 7 right now I am using private ssl on my own tomcat server. 我正在处理托管在tomcat 7上的gwt项目,现在我在自己的tomcat服务器上使用private ssl。 I use following settings to apply ssl in server.xml . 我使用以下设置在server.xml应用ssl。

 <Connector port="12004" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           redirectPort="8443" />
 <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
           maxThreads="150" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS" keystoreFile= "/home/ssl/keystore.jks" keystorePass="PASSWORD"/>

  <Host name="myapp.com" appBase="/home/jvm/apache-tomcat-7.0.35/domains/myapp.com" unpackWARs="true" autoDeploy="true"   xmlValidation="false" xmlNamespaceAware="false">
    <Alias>www.myapp.com</Alias>
  </Host>

This works properly but I think this is not good with perfomece. 这可以正常工作,但我认为这对香水效果不好。 because all the compiled gwt codes and image and css also encrypted with ssl which is according to me not required. 因为所有编译的gwt代码以及图像和css都使用ssl加密,根据我的说法,这不是必需的。 There should only data calls to server should encrypted. 应该只加密对服务器的数据调用。 so how can I do this is there any way to put fillter in ssl so I can speed up my app. 因此,我该怎么做才能将Fillter放入ssl中,从而加快我的应用程序的速度。 or any other way to do this.? 或其他任何方式。 If I am in wrong way please suggest me the best practice of using SSL with GWT app on tomcat. 如果我的方式有误,请建议我在tomcat上将SSL与GWT应用程序一起使用的最佳做法。 Thanks. 谢谢。

If you have your servlets (eg GWT-RPC, RequestFactory, ...) on HTTPS, then you will have to serve your HTML page also from HTTPS (due to the Same Origin Policy ). 如果您在HTTPS上拥有servlet(例如GWT-RPC,RequestFactory等),则您还必须通过HTTPS提供HTML页面(由于Same Origin Policy )。

However, you can serve your JavaScript, CSS, ... files from HTTP. 但是,您可以从HTTP提供JavaScript,CSS等文件。 Just make the links in your HTML page point to the HTTP version of your JS/...-Files, and make sure to compile the GWT code with the cross site (xsiframe) linker: 只需将HTML页面中的链接指向JS /...- Files的HTTP版本,并确保使用跨站点(xsiframe)链接器编译GWT代码:

<add-linker name="xsiframe"/>

The little problem that will arise, however, is that the user's browser will warn, that the site is encrypted, but includes unsafe resources. 但是,将出现的小问题是用户的浏览器将发出警告,该站点已加密,但包含不安全的资源。 This doesn't look very professional (and actually, it is a relatively high security risk), but on the other hand, many (even established) sites still use this approach. 这看起来不太专业(实际上,这是一个相对较高的安全风险),但是另一方面,许多(甚至已建立的)站点仍在使用此方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM