简体   繁体   中英

While accessing http in wildfly9, a blank download file is getting downloaded

I've blocked the http protocol(enabled https only) in wildfly 9.0 by changing below configuration

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.....

it worked..i am able to block the http and enabled https protocol access only. Ideally it should reject the http request. But, now problem is, whenever i am accessing the http://localhost:8080/MyWebApp/ , its rejecting the http request, but at the same time, web page is downloading a blank download file. why ???

Thanks.

You should redirect your http requests to https instead of disabling the http:

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

Add a redirect handler in the handlers part, something along the way of:

<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" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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