This was discussed in an older public issue <https://code.google.com/p/googleappengine/issues/detail?id=2081#c1> which was closed as it's implemented this way due to a design philosophy. However there is an easy workaround - you can issue a 301 redirect manually in your own servlet code if you detect the request URL is HTTP (first remove the security constraint to allow both HTTP and HTTPS by default):
if (!request.isSecure <http://docs.oracle.com/javaee/7/api/javax/servlet/ServletRequest.html#isSecure-->()) { response <http://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletResponse.html> .setStatus(301); // Get original path from request.... response <http://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletResponse.html>.setHeader(“Location”, “https://” + originalPath); } Cheers, Adam Cloud Platform Support On Saturday, November 28, 2015 at 2:39:00 AM UTC-5, Vamsi Krishna Penumatsa wrote: > > Hello, > > I have used security constraints section in appengine-web.xml to redirect > all the http requests on my site to https. The redirect works flawlessly, > however I have noticed that appengine is issuing a 302 redirect. I want the > appengine to use a 301 redirect, for SEO purposes. > > Is there any method/mechanism to make appengine redirect using 301 rather > than 302. > > Thank, > Vamsi > -- 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 http://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/f1df893d-f678-468f-a56b-dece64a92710%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
