java - 在 Wildfly9 中访问 http 时,正在下载一个空白的下载文件

标签 java jboss wildfly wildfly-8 wildfly-9

我通过更改以下配置在 Wildfly 9.0 中阻止了 http 协议(protocol)(仅启用 https)

Changed connector-ref="default" to connector-ref="default-ssl"

<subsystem xmlns="urn:jboss:domain:remoting:3.0">
  <endpoint worker="default"/>
  <http-connector name="http-remoting-connector" connector-ref="default-ssl" security-realm="ApplicationRealm"/>
</subsystem>

Commented the http-listener

<subsystem xmlns="urn:jboss:domain:undertow:2.0">
            <buffer-cache name="default"/>
            <server name="default-server">
               <!-- <http-listener name="default" socket-binding="http" redirect-socket="https"/> -->
                <https-listener name="def.....

它起作用了..我能够阻止 http 并仅启用 https 协议(protocol) 访问。理想情况下它应该拒绝 http 请求。但是,现在的问题是,每当我访问http://localhost:8080/MyWebApp/时,它拒绝http请求,但同时网页正在下载一个空白的下载文件。为什么 ???

谢谢。

最佳答案

您应该将 http 请求重定向到 https,而不是禁用 http:

 <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" redirect-port="443" />

在处理程序部分添加一个重定向处理程序,过程如下:

<host name="other-host" alias="www.mysite.com, ${prop.value:default-alias}" default-web-module="something.war" disable-console-redirect="true">
        <location name="/" handler="welcome-content">
            <filter-ref name="redirects" predicate="!secure" />
        </location>
        <filter-ref name="headers"/>
    </host>
</server>

... https://myserver/'"重定向 = "true"/>

关于java - 在 Wildfly9 中访问 http 时,正在下载一个空白的下载文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37829521/

相关文章:

java - 驻留在 Wildfly 模块中的 JPA 实体类不会被扫描

java - JBoss/WildFly 连接池和关闭连接

java - 如何实现 "extends Application"?

java - 如何监控Spring对象创建?

servlets - jboss部署问题-无法访问servlet

angularjs - 使用 Java EE/Wildfly 的单页应用程序 : server-side configuration

java - 按下 Jbutton 后 JFrame 卡住

java - Spring-WS 的 JAXB header 安全性

java - 了解 ejb-link 标记

java - 在 Wildfly 中注入(inject) EJB 时的安全异常