简体   繁体   中英

Laravel and Guzzle HTTP '406 Not Acceptable'

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM