Using ‘curl’ on page returns 406 Not Acceptable [resolved]

Came across an issue where trying to curl a page to see the result would return a "406 Not Acceptable answer":

# curl http://domain.com/curl.php
<html><head>
<title>406 Not Acceptable</title>
</head><body>
<h1>Not Acceptable</h1>
<p>An appropriate representation of the requested resource /curl.php could not be found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>

I found faking the User agent to Firefox or Mozilla has fixed the issue and gave me the result I wanted:

# curl http://domain.com/curl.php -A "Mozilla"
Curl worked!

You may also like...

3 Responses

  1. steve smith says:

    Brilliant, worked first time! How did you figure that out?

    • David says:

      Found the error in various places online; what I also noticed was that this happened right after I had installed mod_security packages so I figured it *might* have something to do with that.

  2. MrWP says:

    Damn >.< saved my life... ! You are first on Google "curl 406 not acceptable". Thanks for the tip !

Leave a Reply

Your email address will not be published. Required fields are marked *