Link to home
Start Free TrialLog in
Avatar of Pra Sys
Pra SysFlag for India

asked on

Http error 406 Not Acceptable:1

Our client are calling one web API developed by us thru URL. They are getting below http response error -

406 Not Acceptable:1

What could be the reason? Previously API was called without any http request header and it worked well for many months.

my $response = $ua->get($url);

Open in new window


Suddenly we started getting above error. Now they have changed API calling code to send empty http request header with just one attribute "User Agent". They are not passing any value for this attribute. But after this change, it started working again.

my $response = $ua->get($url,'User-Agent' => '',);

Open in new window


What could be possible reasons for it to stop working suddenly and throwing back 406 error? How can I investigate?
Avatar of David Favor
David Favor
Flag of United States of America image

Apache Content Negotiation Sequence covers the gory details of how a request gets to a 406 return code.

406 problems tend to be complex to debug.

You can provide an exact link you're using (including all query parameters) + you might get lucky + someone can assist.

More likely, you'll have to hire a Server Savant to debug this, end-to-end, by reviewing all your LAMP Stack logs.
Avatar of Pra Sys

ASKER

@David Favor - Thanks. I can not share URL details as I am not allowed to. Can I at least get some pointers on why it worked without any request header before and then they had to pass empty "User Agent" attribute in the header to make it work? What might have happened?
Our client are calling one web API developed by us thru URL.
You mean you've developed just the client api? Or do you mean the server code as well?

Also can you say where the Java comes in?
ASKER CERTIFIED SOLUTION
Avatar of noci
noci

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pra Sys

ASKER

@CEHJ - This is a web service written in java which provides this api to client. Url is provided to them. So its a server code Its HTTP request and response. Data exchange is done using Json.
Best resource is to read the link I posted above to the Apache docs which describe exactly how this condition occurs.

Then walk through the docs, verifying which required conditions are failing to be met.
@David, you are assuming that Apache is used to serve this API, which may be true, but let's get some clarification...

@James Bond, can you describe the full path a request would take from the client to your API, ie. are there any load-balancers, reverse-proxies, etc in the path, and what is serving the Java web service, tomcat, jetty, etc?
Avatar of Pra Sys

ASKER

@mccarl - Its very difficult to get information you have asked for. Its tomcat web server serving web service.