【问题标题】:While accessing http in wildfly9, a blank download file is getting downloaded在wildfly9中访问http时,正在下载一个空白的下载文件
【发布时间】:2016-10-16 05:16:05
【问题描述】:

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

将 connector-ref="default" 更改为 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>

评论了 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 协议 访问。理想情况下,它应该拒绝 http 请求。但是,现在的问题是,每当我访问 http://localhost:8080/MyWebApp/ 时,它都会拒绝 http 请求,但与此同时,网页正在下载一个空白下载文件。为什么 ???

谢谢。

【问题讨论】:

  • 无论何时访问 http://yoursite,还是访问 https://yoursite?
  • 只要确保没有错字即可。你怎么知道 HTTP 请求被拒绝了?
  • 在子系统 xmlns="urn:jboss:domain:undertow:2.0" 下评论 http-listener 不会监听 http 请求..right

标签: java jboss wildfly wildfly-8 wildfly-9


【解决方案1】:

您应该将您的 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/'" redirect="true" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-07
    • 1970-01-01
    • 2017-05-15
    • 1970-01-01
    • 1970-01-01
    • 2019-03-22
    • 2013-05-18
    • 1970-01-01
    相关资源
    最近更新 更多