Laravel and Guzzle HTTP '406 Not Acceptable'

2.3k Views Asked by At

I'm having an issue with Laravel and Guzzle. When ever I try this line of code with my external website 'violapractice.com' I get an error:

$res = $client->request('GET','http://violapractice.com/articles.json.php');

Client error: `GET http://violapractice.com/articles.json.php` resulted in a `406 Not Acceptable` response: <html><head><title>Error 406 - Not Acceptable</title><head><body><h1>Error 406 - Not Acceptable</h1><p>Generally a 406 e (truncated...)

I've tried requesting a none php file and get the same error:

$res = $client->request('GET','http://violapractice.com/test.html');

The odd thing is, if I use any other URL, like https://stackoverflow.com the GET request goes through with no issue.

Also, I tired using postman on http://violapractice.com/articles.json.php and it worked fine.

I've never experienced anything like this before. Ideas anyone?

1

There are 1 best solutions below

0
On

In the end, I ended up turning off ModSecurity in the violapractice.com cpanel. I felt that the risk in doing this was minimal because the website is only accessible through admin login and has many layers of security.