The Slim Framework support forum has moved to This Tender forum is no longer maintained or monitored.

Can't receive http response sent by my slim php API

Jakob's Avatar


27 Sep, 2015 02:47 PM


I did already as this on stackoverflow, but I can'f find any help there, so I would be very thankful, if you could take a look here, where I posted the relevant code

I'm quite frustrated and confused, because it seems to be such a simple problem. First I though my angular js might be wrong, since I'm not very familiar with that framwork, but I get the same problem with jquery, making me think it has to be my php code being wrong. I also tried hosting the api on a different server (some crappy free host instead of my linux server) which also didn't make a difference.

  1. 1 Posted by Jakob on 27 Sep, 2015 07:08 PM

    Jakob's Avatar

    Ok i found a solution now.

    Added this to the response function:

    $app->response()->headers->set('Access-Control-Allow-Origin', '*'); $app->response()->headers->set('Access-Control-Allow-Methods', 'GET'); $app->response()->headers->set('AAccess-Control-Allow-Headers', 'X-Requested-With');

    and now it works.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac