[play-framework] how to direct to pages though HTTPS

114 views
Skip to first unread message

Bendanpa

unread,
May 8, 2010, 3:48:41 AM5/8/10
to play-framework
Hi,

I have a toy app running on GAE and GAE nicely supports https request.
all the traffic are over https if I browse the home page with URL
https://myapp

I have one question on how to pre-set a link to a page over https
instead of http?

suppose the page's url is "/alumnicontroller/show?id=6", and the link
is:

href="@{AlumniController.show(xy.id)}"

What should I do to make the link to "https://my-gae-site/
alumnicontroller/show?id=6" (not http://blahblah) so that clicking
this link will make a request over https?

Thanks,
Bendanpa

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

Message has been deleted

Bendanpa

unread,
May 10, 2010, 2:31:30 AM5/10/10
to play-framework
Since I did not get any suggestions I tried myself during the weekend
and managed to make it work. Here is what I was doing:

1) add one method to inner class Secure.Security

static boolean neetSSL() {
return false;
}

this can be customized by user.

2) modify method login of class Secure to:

public static void login() throws Throwable {
if (needSSL() && request.secure == false) {
request.secure = true;
login(); // call itself again to ensure traffic over
https
} else {
// original code here
}

}

3) Without any override then the modified Secure module just works as
before.

4) To customize the default ssl setting I then just override the the
new added method needSSL in my Security class extends Secure.Security
to make
proper setting, i.e, the login request is over https on production
server
only)

Please comment if I anything I did wrong.

Thanks,
Bendanpa

On May 8, 12:48 am, Bendanpa <benda...@gmail.com> wrote:
> Hi,
>
> I have a toy app running on GAE and GAE nicely supports https request.
> all the traffic are over https if I browse the home page with URLhttps://myapp
>
> I have one question on how to pre-set a link to a page over https
> instead of http?
>
> suppose the page's url is "/alumnicontroller/show?id=6", and the link
> is:
>
> href="@{AlumniController.show(xy.id)}"
>
> What should I do to make the link to "https://my-gae-site/
> alumnicontroller/show?id=6"  (nothttp://blahblah) so that clicking

Guillaume Bort

unread,
May 10, 2010, 3:42:09 AM5/10/10
to play-fr...@googlegroups.com
It should be done automatically if your proxy server send these headers:

X-Forwarded-Ssl=on or X-Forwarded-Proto=https

Bendanpa

unread,
May 10, 2010, 1:43:15 PM5/10/10
to play-framework
Thanks, But I don't quite know how to do that with GAE. On GAE, if I
specify hppts://blahblah.appspot.com in browser's URL then it uses
https, if I specify http://blahblah.appspot.com or just type
"blahblah.appspot.com" it uses http.

What I want is to let some pages like the login page travel over https
but did not find an easy way. So I have to tweak the login method in
Secure module.

By the way, do I have a way to override the login method without touch
the secure module?

Thanks,
Bendanpa

Guillaume Bort

unread,
May 10, 2010, 3:57:11 PM5/10/10
to play-fr...@googlegroups.com
Ah ok

So I guess we need to add a new method. Something like:

@{index().secure()}

Bendanpa

unread,
May 10, 2010, 4:52:02 PM5/10/10
to play-framework
Let me know when it is available. I would love to first test it.

Please bare with me with some least instructions on how to use it as I
am a kind of newbie in web dev.

Thanks,
Bendanpa

On May 10, 12:57 pm, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> Ah ok
>
> So I guess we need to add a new method. Something like:
>
> @{index().secure()}
>
>
>
> On Mon, May 10, 2010 at 7:43 PM, Bendanpa <benda...@gmail.com> wrote:
> > Thanks, But I don't quite know how to do that with GAE. On GAE, if I
> > specify hppts://blahblah.appspot.com in browser's URL then it uses
> > https, if I specifyhttp://blahblah.appspot.comor just type

Guillaume Bort

unread,
May 10, 2010, 5:04:36 PM5/10/10
to play-fr...@googlegroups.com
Please report the bug.

Bendanpa

unread,
May 10, 2010, 6:03:49 PM5/10/10
to play-framework
done. see https://bugs.launchpad.net/play/+bug/578516

Thanks,
Bendanpa

On May 10, 2:04 pm, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> Please report the bug.
>
>
>
> On Mon, May 10, 2010 at 10:52 PM, Bendanpa <benda...@gmail.com> wrote:
> > Let me know when it is available. I would love to first test it.
>
> > Please bare with me with some least instructions on how to use it as I
> > am a kind of newbie in web dev.
>
> > Thanks,
> > Bendanpa
>
> > On May 10, 12:57 pm, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> >> Ah ok
>
> >> So I guess we need to add a new method. Something like:
>
> >> @{index().secure()}
>
> >> On Mon, May 10, 2010 at 7:43 PM, Bendanpa <benda...@gmail.com> wrote:
> >> > Thanks, But I don't quite know how to do that with GAE. On GAE, if I
> >> > specify hppts://blahblah.appspot.com in browser's URL then it uses
> >> > https, if I specifyhttp://blahblah.appspot.comorjust type

Javier Zhao

unread,
May 10, 2010, 8:56:58 PM5/10/10
to play-fr...@googlegroups.com
hi:

I have installed the module correctly: play install grizzly

but when i execute "play grizzly: run" command, return the following information:

~ play! 1.0-r1036, http://www.playframework.org
~
~ Oops. E:\Downloads\play-1.0.2 does not seem to host a valid application

How do I solve this problem?

Javier Zhao

unread,
May 10, 2010, 9:01:41 PM5/10/10
to play-fr...@googlegroups.com
hi:

   Perform other command also returns this information:

   1.play install japid

   (Module successfully installed)

  
2.play japid:mkdir


   ~ play! 1.0-r1036, http://www.playframework.org
   ~
   ~ Oops. E:\Downloads\play-1.0.2 does not seem to host a valid application
  

--- 10年5月11日,周二, Javier Zhao <zzy_...@yahoo.com.cn> 写道:

发件人: Javier Zhao <zzy_...@yahoo.com.cn>
主题: [play-framework] Can not execute command......
收件人: play-fr...@googlegroups.com
日期: 2010年5月11日,周二,上午8:56
Message has been deleted

Bendanpa

unread,
May 10, 2010, 9:25:07 PM5/10/10
to play-framework
Why do you change the subject and put non relating question? You
should create new post for your own question.

I changed subject back.

To answer your question, only play 1.1 support "play install a-module"
command

Thanks,
Bendanpa

On May 10, 6:01 pm, Javier Zhao <zzy_s...@yahoo.com.cn> wrote:
> hi:
>
> Perform other command also returns this information:
>
> 1.play install japid
>
> (Module successfully installed)
>
> 2.play japid:mkdir
>
> ~ play! 1.0-r1036,http://www.playframework.org
> ~
> ~ Oops.
> E:\Downloads\play-1.0.2 does not seem to host a valid application
>
> --- 10年5月11日,周二, Javier Zhao <zzy_s...@yahoo.com.cn> 写道:
>
> 发件人: Javier Zhao <zzy_s...@yahoo.com.cn>
> 主题: [play-framework] Can not execute command......
> 收件人: play-fr...@googlegroups.com
> 日期: 2010年5月11日,周二,上午8:56
>
> hi:
>
> I have installed the module correctly: play install grizzly
>
> but when i execute "play grizzly: run" command, return the following information:
>
> ~ play! 1.0-r1036,http://www.playframework.org
> ~
> ~ Oops. E:\Downloads\play-1.0.2 does not seem to host a valid application
>
> How do I solve this problem?
>
> --
>
> You received this message because you are subscribed to the Google Groups "play-framework" group.
>
> To post to this group, send email to play-fr...@googlegroups.com.
>
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
>
> For more options, visit this group athttp://groups.google.com/group/play-framework?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/play-framework?hl=en.

Bing Ran

unread,
May 10, 2010, 10:42:31 PM5/10/10
to play-fr...@googlegroups.com
Hi, you need to run the command from your application's root, not from the
root of Play.



--------------------------------------------------
From: "Bendanpa" <bend...@gmail.com>
Sent: Tuesday, May 11, 2010 6:03 AM
To: "play-framework" <play-fr...@googlegroups.com>
Subject: [play-framework] Re: how to direct to pages though HTTPS
Reply all
Reply to author
Forward
0 new messages