Hey Adam,

In my PHP file, I set:

header('Content-Type: application/json');

But when I look at the output of the file in something like Postman, it 
says it is a gzip encoding with an html/text content type. It appears that 
the content type header is being stripped from the PHP output.

-Mike


On Saturday, November 12, 2016 at 12:36:41 PM UTC-5, Adam (Cloud Platform 
Support) wrote:
>
> You should be able to set any response header in your handler code. Can 
> you elaborate on how you're trying to set it in your PHP script, and what 
> you mean by "doesn't work in the file because of the compression" ?
>
> On Wednesday, November 9, 2016 at 4:15:38 PM UTC-5, Mike Tickle wrote:
>>
>> Hello everyone,
>>
>> I have written a pretty simple API in PHP and am running it as a service (
>> https://protoapi-dot-rehash-148415.appspot.com/events/).
>>
>> When I try to load a data grid with the JSON from the API, I am getting 
>> the dreaded "No 'Access-Control-Allow-Origin' header is present on the 
>> requested resource." error on the page on which I want to consume the JSON. 
>> (http://proto-angular-dot-rehash-148415.appspot.com/events.php)
>>
>> I've tried a couple of different methods to add 
>> Access-Control-Allow-Origin: "*" to the app.yaml file and to the header in 
>> the PHP file that produces the API. I think it doesn't work in the yaml 
>> because you cannot apply http_headers to dynamic files, and it doesn't work 
>> in the file because of the compression.
>>
>> Is there any other way to make this work, short of putting the API and 
>> the app in the same service? I'd hate to do that because I am using 
>> mod_rewrite for the API and it will probably cause chaos on my app.
>>
>> Any insights would be greatly appreciated!
>>
>> -Mike
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/4fdae6ff-d463-439f-879e-a1774cad2bc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to