how to automatically add http headers to reponses from GAE java

18 views
Skip to first unread message

jie lin

unread,
Nov 13, 2020, 10:23:21 AM11/13/20
to Google App Engine
Hi Support team

Could we add http response headers via the configuration in appengine-web.xml?

I have tried to add the following to appengine-web.xml. however the header is only added to html resources.  Is it possible that we can add respone headers to all responses? 
For Jetty, it is possible by using rewrite in Jetty configuration but don't want directly configure Jetty (like add Jetty filters, etc )

thank you

Jie

<static-files>
<include path="/**" >
<http-header name="Access-Control-Allow-Origin"
value="http://example.org" />
</include>
</static-files>

Elliott (Cloud Platform Support)

unread,
Nov 13, 2020, 5:37:26 PM11/13/20
to Google App Engine
Hello Jie,

I was able to find this documentation that may help you. To find more information, can you please provide more detail about the header only being added to html resources? If you are using the Spring Framework, I have found the information here that may assist you. I hope this is of value to you regarding if you can add response headers to all responses.

Reply all
Reply to author
Forward
0 new messages