Wildfly:http到https重定向在同一端口上

时间:2019-06-11 11:37:51

标签: redirect configuration wildfly wildfly-15

问题

如何将http请求重定向到同一端口上的https请求?


用例

有人打开mypage:1234,但忽略了协议。 用户仍然希望进入该页面。


类似问题

here提供的解决方案几乎可以解决我的问题,但是我不知道在编译时使用的域名,客户以后不必再配置它。


尝试解决方案

standalone-full-template.xml

<subsystem>
  <server name="default-server">
    <host name="default-host" alias="localhost">
      <location name="/" handler="welcome-content"/>
      <http-invoker security-realm="ApplicationRealm"/>
      <filter-ref name="http-to-https" predicate="equals(%H,http) and equals(%p,1234)"/>
    </host>
  </server>
  <filters>
    <rewrite name="http-to-https" redirect="true" target="https://%v:1234%U"/>
  </filters>
</subsystem>

来源

variables


注意

这个问题已经在Serverfault上提出过。 但由于没有答案,因此在Stackoverflow上提出并回答了最相关的问题,因此我将其移开了。

0 个答案:

没有答案
相关问题