I'm currently facing a strange problem and I cannot narrow down the issue.
In my Laravel application I am retrieving data via AJAX. Therefore parts of the application respond with the application/json
content-type.
return Response::json(['message' => 'Some message']);
on my local webserver everything works just fine. I get Content-Type:application/json
as a response.
I deployed the application on the server (also apache) and tested it. But here is the problem. I do not get the proper content-type anymore. Instead I get text/html
.
So there's a bunch of possible problem sources and I am not too much into server configuration. But here are the things I already tried:
- Made sure that the server has the json extension and it is enabled
- Checked the laravel source for hints why it would not return the proper content/type (I couldn't find anything)
- Checked the response contents locally and on the server (it does not differ)
- I noticed that the Response-Header contains locally
Set-Cookie
which contains:laravel_session=[...]
whereas the response on the server does not.
Please refrain from posting answers that suggest to check for the content-type and parse it if necessary on the client side, because although that would be possible, the server should not behave like that and I'm trying to figure out why