Issue
I have an Apache 2.2 http server running on my machine for testing purposes. All it does on a specific port is redirecting to an external site.
The VirtualHost section in my httpd.conf file looks like this:
<VirtualHost *:8001>
ServerName localhost
Redirect / http://www.google.com
LogLevel debug
</VirtualHost>
Now when I do this, the resulting http response has
Content-Type: text/html; charset=iso-8859-1
But I would like the Content-Type to be application/json
. Is there any way to achieve this?
I've found this question in which the answer was to use Header set Content-type ...
, but this didn't change anything for me.
Solution
You must use "always" modifier to make sure it happens in all cases, in this case you need it.
<VirtualHost *:8001>
ServerName localhost
Redirect / http://www.google.com/
Header always set Content-Type "application/json"
</VirtualHost>
and you will get something like:
HTTP/1.1 302 Found
Date: Wed, 07 Feb 2018 18:30:42 GMT
Server: Apache
Content-type: application/json
Location: http://www.google.com/
Answered By - ezra-s Answer Checked By - Mary Flores (WPSolving Volunteer)