Results 1 to 2 of 2

Thread: Solve apache / tomcat 404 error

  1. #1
    Join Date
    Nov 2009
    Posts
    583

    Solve apache / tomcat 404 error

    Apache / Tomcat 404 error


    Problem Description :
    When two application servers running in tandem it is not always easy to correctly handle error pages and among them the famous page 404.Where should he manage to put this page? In httpd? In tomcat? How to be sure it is properly managed? Where two application servers working for the same application, you must know what is everyone's job. If the server httpd, it is static resources that are static pages (. htm and . html), scripts (. js and . css) and images (. jpg, . gif, . png). For Tomcat, these are servlets and pages JSP.



  2. #2
    Join Date
    Nov 2009
    Posts
    583

    Re: Solve apache / tomcat 404 error

    Each server can handle himself back page (and thus the return code) if resource not found. For httpd, it is the directive DocumentError taking two parameters (error code Treaty and the page is allocated to them) (for example):
    Code:
    DocumentError 404 / 404.html
    And tomcat xml block: view sourceprint?
    Code:
    <error-page>
    <error-code> 404 </error-code>
    <Rental> / 404.jsp </rental>
    </error-page>
    The problem with these two application servers is the need to unify the "Pages 404". There are several possibilities:
    - Use two separate pages, one for httpd and another for tomcat

    The problem with this solution is that there are 2 pages maintained in the event of change by example graphic
    - Use an HTML page for the 2 application servers

    If one uses a simple HTML page, you lose the power of Java and therefore the possibility to customize the error page
    - Using a JSP for both httpd and tomcat

    By specifying a JSP page to httpd, if resource not found error, this page will be well produced. However, there remains a problem: for example, calling the page 404.jsp, tomcat will review this page (existing) but also produce a return code 200 (OK resource) which is a problem for search engines (like google ). The only solution was satisfactory to produce a customized error page while returning the correct return code (404) is set to httpd error page JSP, inextistante.
    For example, for httpd :


    DocumentError 404 / # page404Inexistante.jsp Page not found
    and tomcat :
    Code:
    <error-page>
    <error-code> 404 </error-code>
    <Rental> / 404.jsp </rental> <! - existing page ->
    </error-page>
    So, when applying for a static resource does not exist, httpd will try to produce a JSP page does not exist in tomcat who will turn over in producing the correct error page by producing the correct error code.

Similar Threads

  1. Replies: 4
    Last Post: 05-05-2012, 05:59 PM
  2. Install and configuring Apache Tomcat on Linux
    By VivRichards in forum Operating Systems
    Replies: 5
    Last Post: 10-11-2010, 01:35 PM
  3. Apache Tomcat -- JSP HTTP 404 Error!!
    By ScarFace 01 in forum Software Development
    Replies: 4
    Last Post: 22-07-2010, 06:01 AM
  4. Apache error NameVirtualHost *:80 Has No VirtualHosts
    By Monil in forum Networking & Security
    Replies: 3
    Last Post: 16-05-2009, 07:25 PM
  5. How to install Apache Tomcat on Windows Vista
    By Janhavi4U in forum Windows Software
    Replies: 3
    Last Post: 19-02-2009, 10:32 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,556,947.65088 seconds with 16 queries