request.secure returns false when using Apache and mod-proxy

140 views
Skip to first unread message

Alex Jarvis

unread,
Nov 11, 2010, 11:47:58 AM11/11/10
to play-framework
Hi,

I was wondering if anyone here has tried to setup Play with Apache to
serve HTTPS requests. I believe that I have configured everything
correctly and I am able to connect to "https://localhost/" without any
problem.

The problem is that I cannot detect if the request is secure or not
because when I get "request.secure" in my Controller, it always
returns false.

I am using Play 1.0.3.2 and Apache2.

Many Thanks,
Alex

Matt Hildebrand

unread,
Nov 11, 2010, 12:41:22 PM11/11/10
to play-fr...@googlegroups.com
I was wondering if anyone here has tried to setup Play with Apache to
serve HTTPS requests. I believe that I have configured everything
correctly and I am able to connect to "https://localhost/" without any
problem.

The problem is that I cannot detect if the request is secure or not
because when I get "request.secure" in my Controller, it always
returns false.

The requests from the browser to Apache are SSL-protected, but it sounds like the requests from Apache to Play are not.  Accordingly, Play will correctly report that the HTTP requests it receives did not arrive via SSL.

You probably want one of the following:
- SSL between Apache and Play.
- Logic in your application to 'know' that communication between browsers and Apache is over SSL.

-Matt

Alex Jarvis

unread,
Nov 11, 2010, 1:19:33 PM11/11/10
to play-framework
Thanks for your reply, but have you got any idea how I can obtain SSL
between Apache and Play?

I thought the whole point of using Apache was because Play doesn't
support SSL...

Alex

Matt Hildebrand

unread,
Nov 11, 2010, 1:44:56 PM11/11/10
to play-fr...@googlegroups.com
Thanks for your reply, but have you got any idea how I can obtain SSL
between Apache and Play?

You would have to configure Apache to use SSL when it makes requests to Play.

I thought the whole point of using Apache was because Play doesn't
support SSL...

No, it's for other reasons:

Incidentally, Play does support SSL as of version 1.1:
If all you want from Apache is SSL, then doing this instead is probably your simplest solution.

-Matt

Guillaume Bort

unread,
Nov 11, 2010, 1:59:06 PM11/11/10
to play-fr...@googlegroups.com
You must configure your apache to forward either
"XForwardedProto=HTTPS" or "X-Forwarded-Ssl" header.

> --
> 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.
>

--
Guillaume Bort, http://guillaume.bort.fr

For anything work-related, use g...@zenexity.fr; for everything else,
write guillau...@gmail.com

Alex Jarvis

unread,
Nov 11, 2010, 3:47:00 PM11/11/10
to play-framework
Wow thanks guys. You've really helped me with this. I think I'll be
upgrading to 1.1! The only reason I reverted back to 1.0 was because
1.1 doesn't work on the Stax cloud, but now I've realised I need SSL
and they don't support it anyway...

I think I may have to find a VPS somewhere unless playapps.net decide
to create more trial slots.

And thanks Guillaume, I didn't know that you could do this and may end
up using in future :)

For what it's worth I created a ticket on lighthouse a while ago for
the stax issue if you want more detail (although I won't be using them
anymore):
http://play.lighthouseapp.com/projects/57987/tickets/304-table-doesnt-exist-on-stax#ticket-304-1

Thanks,
Alex
> Guillaume Bort,http://guillaume.bort.fr
>
> For anything work-related, use g...@zenexity.fr; for everything else,
> write guillaume.b...@gmail.com

Guillaume Bort

unread,
Nov 12, 2010, 3:40:21 AM11/12/10
to play-fr...@googlegroups.com
> I think I may have to find a VPS somewhere unless playapps.net decide
> to create more trial slots.

It should open publicly before the end of the year. The private beta
is totally saturated with about 100 trial applications running for
free.

> For what it's worth I created a ticket on lighthouse a while ago for
> the stax issue if you want more detail (although I won't be using them
> anymore):
> http://play.lighthouseapp.com/projects/57987/tickets/304-table-doesnt-exist-on-stax#ticket-304-1

It's not a bug, and easy to fix, check my response:

http://play.lighthouseapp.com/projects/57987-play-framework/tickets/304-table-doesnt-exist-on-stax#ticket-304-2

--
Guillaume Bort, http://guillaume.bort.fr

For anything work-related, use g...@zenexity.fr; for everything else,

write guillau...@gmail.com

Alex Jarvis

unread,
Nov 12, 2010, 7:17:21 AM11/12/10
to play-framework
Thanks a lot Guillaume. I'm really impressed with the speed (and
helpfulness) of the response from the Play community!

On Nov 12, 8:40 am, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> > I think I may have to find a VPS somewhere unless playapps.net decide
> > to create more trial slots.
>
> It should open publicly before the end of the year. The private beta
> is totally saturated with about 100 trial applications running for
> free.
>
> > For what it's worth I created a ticket on lighthouse a while ago for
> > the stax issue if you want more detail (although I won't be using them
> > anymore):
> >http://play.lighthouseapp.com/projects/57987/tickets/304-table-doesnt...
>
> It's not a bug, and easy to fix, check my response:
>
> http://play.lighthouseapp.com/projects/57987-play-framework/tickets/3...
>
>
>
>
>
>
>
>
>
> On Thu, Nov 11, 2010 at 9:47 PM, Alex Jarvis <alex.jarv...@gmail.com> wrote:
> > Wow thanks guys. You've really helped me with this. I think I'll be
> > upgrading to 1.1! The only reason I reverted back to 1.0 was because
> > 1.1 doesn't work on the Stax cloud, but now I've realised I need SSL
> > and they don't support it anyway...
>
> > I think I may have to find a VPS somewhere unless playapps.net decide
> > to create more trial slots.
>
> > And thanks Guillaume, I didn't know that you could do this and may end
> > up using in future :)
>
> > For what it's worth I created a ticket on lighthouse a while ago for
> > the stax issue if you want more detail (although I won't be using them
> > anymore):
> >http://play.lighthouseapp.com/projects/57987/tickets/304-table-doesnt...
> > For more options, visit this group athttp://groups.google.com/group/play-framework?hl=en.
Reply all
Reply to author
Forward
0 new messages