php - Apache 406 Not Acceptable when specifying Accept: header -
I have tried to find a solution for this, but the solution to the other 406 issues has not helped me.
I have enabled the PHP and Apache web server on Mac. I have found that if I accept that a request (Post or GET) accepts: Header set, then with a 406 error Fails:
$ curl -X GET -H "Accept: Application / Json" http: // localhost / test / tester & lt ;; DOCTYPE HTML PUBLIC "- // IETF // DTD HTML 2.0 / N" & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; 406 Not Acceptable & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; H1 & gt; Not acceptable & lt; / H1> & Lt; P & gt; The proper representation of the requested resource / test / tester was not found on this server. & Lt; / P & gt; Available Versions: & lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "tester.php" & gt; Tester Php & lt; / A & gt; , Type Application / X-HPD-PHP & lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Body & gt; & Lt; / Html & gt; However, if I do not accept "Accept: Application / JS", then the error is executed without error.
I tried to add this test / tester. Test / tester.fp as DIR):
URI: tester content type: application / jason urai: tester.fp My intention is to Apache Execute tester.php to handle the request with "Approval: Application / Jason". But it has not been able to help me (I added 'AddHandler type-map .var' under 'ifmodule mime_module' inside the 'http:.' File and restarted the server).
'mod_security' does not appear to be configured, but I added my test / directory to the following .htaccess anyway:
These are the solutions that I found on the net, no one has worked for me.
Any thoughts?
I have finally decided one! As I suspect, * mod_security * had nothing to do with my problem. Here are the changes made to /etc/apache2/httpd.conf : - In the "IfModule mime_module" section, addHandler type- Maps var "cancels the active map of the type.
-
The following two rows were added to the "IfModule mime_module" section:
AddType application / x-httpd-php .php MultiviewsMatch handler filter In my PHP source directory, I created a tester.var in the same directory with the tester.php content Gone: Content Type: Application / Jason URI: Tester.php Now it's all good.
Comments
Post a Comment