The easiest way is in your response, just redirect via JavaScript:

window.location = "https://example.com";;

But that's sort of sloppy and doesn't return 301 response codes to tell 
search engines to update their links. If it's not a website indexed by 
Google then this probably won't matter and would solve the problem.

Other than that, Spring Security has tools that can force HTTPS, although 
I'm not sure if it actually does the redirect. 

If you do need a 301 redirect -- or wish to have a nice, clean server-side 
approach -- there's also the Tuckey URLRewriter -- 
http://tuckey.org/urlrewrite/ -- which lets you catch certain urls matching 
a pattern and 301 redirect them to another url.  For instance 
http:\/\/.*example\.com could be redirected to https instead.

Lastly, you could also just do this:

if(request.getScheme().equals("http") && (request.getRequestURI().equals("") 
|| request.getRequestURI().equals("/")) {
    // set the response code as 301, moved permanently
    response.setStatus(301);  // tell the requestor the url is permanently 
redirected
    response.sendRedirect("https://example.com";);   
}


Hope this helps,
James

On Saturday, July 27, 2013 8:43:22 PM UTC-7, Dhrumil Shah wrote:
>
> Google apps gives me options to redirect from http://example.com to 
> http://www.example.com, but not for https. 
> Any suggestions?
>
>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to