# Ssl\_requirement not working

**URL:** <https://www.ruby-forum.com/t/ssl-requirement-not-working/76671>\
**Category:** Rails\
**Created:** [November 20, 2006, 2:46pm UTC](https://www.ruby-forum.com/t/ssl-requirement-not-working/76671 "2006-11-20T14:46:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@Chad](https://www.ruby-forum.com/u/Chad)\
**Post date:** [November 20, 2006, 2:46pm UTC](https://www.ruby-forum.com/t/ssl-requirement-not-working/76671/1 "2006-11-20T14:46:59Z")

</div>

Forgive me if this isn’t 100% rails, but I’m trying to get  
ssl\_requirement to work and it sends my app into an infinite loop  
because @request.ssl? is always returning false, even if I’m using  
https://

For some reason, my @request isn’t getting any SSL info: neither  
@request.ssl? nor @request.env[“HTTPS”] return true.

I’m using pound/mongrel with a trial certificate from verisign. I’m  
missing something…

Thanks in advance,  
Chad

---

<div class="post-metadata">

**Author:** ![Chad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@Chad](https://www.ruby-forum.com/u/Chad)\
**Post date:** [November 20, 2006, 2:47pm UTC](https://www.ruby-forum.com/t/ssl-requirement-not-working/76671/2 "2006-11-20T14:47:11Z")

</div>

Further inspection: whether I’m at [http://mysite.com](http://mysite.com) or  
[https://mysite.com](https://mysite.com) I still get the following:

@request.port → 80  
@request.protocol → http://  
@request.ssl → false

What gives? Server setup?

---

<div class="post-metadata">

**Author:** ![Chad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@Chad](https://www.ruby-forum.com/u/Chad)\
**Post date:** [November 20, 2006, 4:08pm UTC](https://www.ruby-forum.com/t/ssl-requirement-not-working/76671/3 "2006-11-20T16:08:50Z")

</div>

What sort of deployment are you using ? If you have apache proxying to a  
bunch of mongrels for example then (because the actual bit in between  
apache and mongrel isn’t SSL) then you need to do something like  
RequestHeader set X\_FORWARDED\_PROTO ‘https’  
in your apache conf so that this information gets as far as the mongrel.

Fred

---

<div class="post-metadata">

**Author:** ![Chad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@Chad](https://www.ruby-forum.com/u/Chad)\
**Post date:** [November 21, 2006, 5:47am UTC](https://www.ruby-forum.com/t/ssl-requirement-not-working/76671/4 "2006-11-21T05:47:24Z")

</div>

My host provider is saying this: "Unfortunately with Apache 1.x it is  
not possible to pass the header using the proxy directive, you would  
also have to pass the header from pound to mongrel. "

Are there any other suggestions for how I can detect if the user is  
using an SSL connection?

Chad

---

<div class="post-metadata">

**Author:** ![Chad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@Chad](https://www.ruby-forum.com/u/Chad)\
**Post date:** [November 20, 2006, 10:30pm UTC](https://www.ruby-forum.com/t/ssl-requirement-not-working/76671/5 "2006-11-20T22:30:21Z")

</div>

That’s what I suspected… Thanks Fred I’ll talk to my host provider.  
I’m not used to _not_ having 100% control over my environment.

Chad
