1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Why HTTP 501 error of type JSON presented to UI as text/html instead of application/json?

Discussion in 'Apache' started by akatnet, May 28, 2016.

  1. #1
    I have front-end Angular running on Apache with back-end Spring REST API on Tomcat. Both Tomcat and Apache are fronted by load balancers running in AWS.



    I wanted to throw 501 error in some error case and want that response to be presented as JSON to UI (Content-Type as "application/json"). This works fine in my local as expected with Angular is able to interpret the JSON response but when it comes to some common QA environment it fails because the 501 error presented to UI as text/html which Angular can't digest.



    Difference between my local and QA is, Angular is running on node whereas QA uses Apache. Is the apache who is converting JSON response with 501 http code to html type?



    I have setup ErrorDocument in httpd.conf only 500 and 400 errors, but Apache still intercepting 501 errors and throwing its own content in html format.



    the response i get on my browser is below.



    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

    <html><head>

    <title>501 Not Implemented</title>

    </head><body>

    <h1>Not Implemented</h1>

    <p>GET to /test/customer/getCustomer not supported.<br />

    </p>

    </body></html>
     
    akatnet, May 28, 2016 IP