Redirect http to https?

4,334 views
Skip to first unread message

Phil McDonnell

unread,
Jun 24, 2010, 7:09:31 PM6/24/10
to google-a...@googlegroups.com
Is there any way to redirect http traffic to https on app engine?  For instance, I want users who type in http://x.appspot.com into the browser to automatically get redirected to https://x.appspot.com.  Any idea if this is possible in GAE?

Thanks,
Phil

Robert Kluin

unread,
Jun 24, 2010, 10:44:31 PM6/24/10
to google-a...@googlegroups.com
If you are using python you can configure app.yaml to automatically redirect to https. Just add "secure: always" to you handler mappings. 


Robert

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.

l.denardo

unread,
Jun 25, 2010, 4:13:49 AM6/25/10
to Google App Engine
The same in Java configuring web.xml as stated here:

http://code.google.com/appengine/docs/java/config/webxml.html#Secure_URLs

(on appspot.com only, not for custom apps domains)

Regards
Lorenzo

On Jun 25, 4:44 am, Robert Kluin <robert.kl...@gmail.com> wrote:
> If you are using python you can configure app.yaml to automatically redirect to https. Just add "secure: always" to you handler mappings.
>
> http://code.google.com/appengine/docs/python/config/appconfig.html
>
> Robert
>
> On Jun 24, 2010, at 16:09, Phil McDonnell <phil.a.mcdonn...@gmail.com> wrote:
>
> > Is there any way to redirect http traffic to https on app engine?  For instance, I want users who type inhttp://x.appspot.cominto the browser to automatically get redirected tohttps://x.appspot.com.  Any idea if this is possible in GAE?

Phil McDonnell

unread,
Jun 25, 2010, 6:31:38 PM6/25/10
to Google App Engine
This is a great pointer! However, I'm having a little trouble getting
this to actually work and I'm confused as to why nothing seems to
redirect. I would think the following would just redirect everything
on my site through https. Any idea why that doesn't work or a way to
instrument what is going on? I'm on the latest appengine & gwt
versions.

Section I added to web.xml:

<!-- Security constraints -->
<security-constraint>
<web-resource-collection>
<url-pattern>*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

On Jun 25, 1:13 am, "l.denardo" <lorenzo.dena...@gmail.com> wrote:
> The same in Java configuring web.xml as stated here:
>
> http://code.google.com/appengine/docs/java/config/webxml.html#Secure_...
>
> (on appspot.com only, not for custom apps domains)
>
> Regards
> Lorenzo
>
> On Jun 25, 4:44 am, Robert Kluin <robert.kl...@gmail.com> wrote:
>
>
>
> > If you are using python you can configure app.yaml to automatically redirect to https. Just add "secure: always" to you handler mappings.
>
> >http://code.google.com/appengine/docs/python/config/appconfig.html
>
> > Robert
>
> > On Jun 24, 2010, at 16:09, Phil McDonnell <phil.a.mcdonn...@gmail.com> wrote:
>
> > > Is there any way to redirect http traffic to https on app engine?  For instance, I want users who type inhttp://x.appspot.comintothe browser to automatically get redirected tohttps://x.appspot.com.  Any idea if this is possible in GAE?

l.denardo

unread,
Jun 28, 2010, 3:38:42 AM6/28/10
to Google App Engine
Sorry but I can't really help, since it looks like your web.xml has
everything correct.

The only suggestions I can give are:
-Try using /* instead of * in your constraint. This might seem a
stupid suggestion, but I faced similar problems many times (escape
characters in URLs seem particularly prone to errors).
-Be aware that https is only available on appspot.com subdomains, and
does not work if you deploy your app to your own site.

Regards
Lorenzo
> > > > Is there any way to redirect http traffic to https on app engine?  For instance, I want users who type inhttp://x.appspot.comintothebrowser to automatically get redirected tohttps://x.appspot.com.  Any idea if this is possible in GAE?

Phil McDonnell

unread,
Jun 29, 2010, 3:14:30 AM6/29/10
to Google App Engine
It turns out that I needed to add a <web-resource-name> tag. Here's
the working piece:

<!-- Security constraints -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

> > > > > Is there any way to redirect http traffic to https on app engine?  For instance, I want users who type inhttp://x.appspot.comintothebrowserto automatically get redirected tohttps://x.appspot.com.  Any idea if this is possible in GAE?
Reply all
Reply to author
Forward
0 new messages