Question

I'm very new to Restler3. And a very happy new user! My object was basically to setup a EC2 which using Restlers clever routing can rewrite streaming manifests (the manifest basically tells which fragments of video/audio/subtitle to stream). All is very good. Restler gets the Manifest, does the rewriting and easily sends it back to requestor.

Now I am trying to squeeze something else into Restler. I need Restler to respond with an MP4-header formatted XML-Subtitle-TTML chunk.

You might ask, why squeeze this onto a Restler-platform? A. The routing in Restler makes everything so much easier. B. Why not try it out?

So, I have managed to get Restler to do almost what I need. I simply bypass Restlers return statement. I simply echo() out the binary data to requestor. And amazingly it all works.

My only tiny problem left to sort out is Content-Type. All my other "normal" xml-requests return "text/html" when testing with this awkward way of returning the response, using simple echo-statements of nicely handcrafted XML. So I try to override with header('Content-type: text/xml'); Which also gets returned.

The problem is that somehow the binary response with an MP4-header gets forced by "someone" into Content-Type: application/json; charset=utf-8 although I have set header('Content-type: text/xml');

Any clues what I could do to override this?

Was it helpful?

Solution

Easiest way to fix headers Content-type is by adding this header and then exiting your function. And by doing the exit; cheating Restler into replying with the (maybe non-standard) Content-type.

header('Content-type: text/xml');
exit;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top