WLP ::在http上更改默认上下文根

时间:2014-11-11 20:22:29

标签: websphere websphere-liberty

当我在我的websphere自由配置文件v8.5.5(我假设为http://my.domain.com)上进行http get时,我会看到一个很好的页面,其中包含其他内容 “欢迎使用WebSphere Application Server V8.5 Liberty Profile”

看起来像http://rdt1.demos.ibm.com/

如何将我的服务器配置为不显示此页面,并可能将我的请求重定向到https上的登录页面?

这是一个与要安装的新应用的新上下文根有关的配置吗?喜欢下面这个答案? How to make "HTTPS redirect" work on WebSphere Application Server Liberty Profile? 我觉得这应该是在server.xml上配置的东西,但我找不到任何对此的引用。

提前致谢!

2 个答案:

答案 0 :(得分:5)

您可以通过将以下内容添加到server.xml文件来关闭该页面:

<httpDispatcher enableWelcomePage="false" />

http://www-01.ibm.com/support/knowledgecenter/api/content/nl/en-us/SSRTLW_9.0.0/com.ibm.websphere.wlp.nd.multiplatform.doc/autodita/rwlp_metatype_4ic.html#mtFile119

编辑

我应该澄清,另一个答案也是正确的。如果您使用&#34; /&#34;安装应用程序作为上下文根,它将被用来代替主页面。

如果您将以下内容添加到该应用程序的web.xml:

<security-constraint>
    <display-name>Some constraint</display-name>
    <web-resource-collection>
        <web-resource-name>All</web-resource-name>
        <description>All URLs</description>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <description>All users</description>
        <role-name>User</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>

您将获得您要求的https重定向。

其他编辑(每条评论),以下是如何设置重定向的更完整示例: How to make "HTTPS redirect" work on WebSphere Application Server Liberty Profile?

答案 1 :(得分:3)

只需创建您的应用程序并在server.xml指定上下文根目录中,如下所示:

<webApplication id="MyApp" location="MyApp.war" name="MyApp" contextRoot="/"/>

如果您想重定向到登录页面和ssl,那么您需要在所引用的帖子中执行所有步骤,当然还要在您的应用程序中提供登录页面。

如果您只想禁用欢迎页面,请添加到ebullient提供的server.xml片段,或者甚至通过添加一些可以重定向的JavaScript代码来扩展它:

<httpDispatcher enableWelcomePage="false" appOrContextRootMissingMessage='&lt;script&gt;document.location.href="/MyApp/";&lt;/script&gt;'></httpDispatcher>