Apache-Weblogic 404 configuration

。_饼干妹妹 提交于 2019-12-11 05:04:40

问题


I've searched around for this quite a bit and found similar questions but not exactly the same, but nonetheless I apologize if this is a duplicate question.

Basically, I am trying to handle HTTP error responses (i.e. 404) with a custom error page (i.e. 404.html) when my application is down, but weblogic is still up.

I am using Apache 2.2 with the weblogic module. I have set the ErrorDocument directive for Apache as well as the ErrorPage parameter within the block.

I have also set the location within my web.xml for my application, but this question is for when the application is down.

Currently, when the app is down and weblogic is running I am getting the weblogic default 404 page. How can I force apache and/or weblogic to use my custom page?

Here is a sample of one variation of the config that I have tried.

 <IfModule mod_weblogic.c>
    WebLogicCluster host:port,host:port
    KeepAliveEnabled ON
    WLProxySSL OFF
    Debug ALL
    ErrorPage http://host:port/errors/errorSystem.html
</IfModule>

I can access the error page directly, but traffic is never forwarded on error.

I've also tried to set the ErrorPage to a relative url which is the ideal solution.


回答1:


The explanation from apache.org do it also with samples of code:

ErrorDocument 500 http://xxx/
ErrorDocument 404 /Lame_excuses/not_found.html
ErrorDocument 401 /Subscription/how_to_subscribe.html 



回答2:


According to WebLogic documentation, with ErrorPage parameter, "The plug-in redirects to an error page when the back-end server returns an HTTP 503/Service Unavailable response and there are no servers for failover.".

So 404 error from WebLogic will not be redirected to our custom error page specified with ErrorPage parameter.

The workaround is to create a simple webapp and deploy it onto your WebLogic. In this webapp:

  1. in [web.xml] Specifiy your custom error code and page mappings, e.g.:

    <error-page>
      <error-code>404</error-code>
      <location>/errors/404.html</location>
    </error-page>

  2. in [weblogic.xml] State that your context-root is '/':

    <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <context-root>/</context-root>
    </weblogic-web-app>

  3. Your need to have error pages in place such as in '/errors' folder of you webapp.

Note that the 'FMW Welcome Page Application' might have already been deployed and using '/' as context-root in your WebLogic domain. If that is the case, I believe it is safe to undeploy it or untarget it, but you are advised to raise a SR to product support asking whether it is hardful to do so.



来源:https://stackoverflow.com/questions/19542679/apache-weblogic-404-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!