这里声明可以设置 X-POWERED-BY header 外观。但我不知道如何通过 weblogic.xml
定义此属性。有人知道该怎么做吗?
In general, these properties can be overridden at the cluster level (in ClusterMBean, if the same property is present there), the server level (in ServerMBean, if the same property is present there) or for a specific Web application (in weblogic.xml)
http://docs.oracle.com/cd/E11035_01/wls100/wlsmbeanref/core/index.html
最佳答案
您应该尝试的第一件事是通过管理控制台编辑您的域设置:
<domain name> -> Configuration -> Web Applications
将 X-Powered-By Header:
下拉列表更改为 whatever setting you need .
对于特定的应用程序,例如 servlet,您还可以调用此方法:
HttpServletResponse setHeader()
如果您需要通过 web.xml 文件删除它,您可以尝试:
<context-param>
<param-name>com.sun.faces.sendPoweredByHeader</param-name>
<param-value>false</param-value>
</context-param>
如果您想使用 WLST 进行设置,请尝试:
connect(username, password, host_info)
edit()
cd("/WebAppContainer/" + domainName)
startEdit()
# set to NONE, SHORT, MEDIUM, or FULL
cmo.setXPoweredByHeaderLevel("NONE")
activate()
关于http-headers - 如何在weblogic.xml中设置X-POWERED-BY?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31875469/