# Redirect\_to puts me from https to http

**URL:** <https://www.ruby-forum.com/t/redirect-to-puts-me-from-https-to-http/108307>\
**Category:** Rails\
**Created:** [July 2, 2007, 4:05am UTC](https://www.ruby-forum.com/t/redirect-to-puts-me-from-https-to-http/108307 "2007-07-02T04:05:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/839c29/32.png) [@pedz](https://www.ruby-forum.com/u/pedz)\
**Post date:** [July 2, 2007, 4:05am UTC](https://www.ruby-forum.com/t/redirect-to-puts-me-from-https-to-http/108307/1 "2007-07-02T04:05:07Z")

</div>

I’m trying to deploy my application. I basically followed the cookbook  
in the rails book. But I have a problem.

My incoming requests are [https://foo.com/whatever](https://foo.com/whatever) I do a RewriteRule to  
pass it to a Proxy with two mongrel BalanceMembers as  
[http://127.0.0.1:8000](http://127.0.0.1:8000) and 8001. All that is working fine except when my  
rails code executes a redirect\_to there(id) function. That puts me back  
to an http request. I have my Apache server set up so that you can not  
get to these pages using http so the server gives me back a page not  
found or permission denied or something like that.

I think I understand why this is happening. As far as mongrel and rails  
thinks, this is an http request.

Can I get mongrel to pass the request to rails as if it was https?

Thank you for your help,  
Perry

---

<div class="post-metadata">

**Author:** ![pedz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/839c29/32.png) [@pedz](https://www.ruby-forum.com/u/pedz)\
**Post date:** [July 2, 2007, 4:47am UTC](https://www.ruby-forum.com/t/redirect-to-puts-me-from-https-to-http/108307/2 "2007-07-02T04:47:42Z")

</div>

On Mon, 2007-02-07 at 04:05 +0200, Perry S. wrote:

> I think I understand why this is happening. As far as mongrel and rails  
> thinks, this is an http request.
> 
> Can I get mongrel to pass the request to rails as if it was https?

Try adding these two lines to your apache configuration:

RequestHeader set X\_FORWARDED\_PROTO “https”  
RequestHeader set X\_ORIGINAL\_PROTOCOL “https”

If you’re using VirtualHost blocks, these lines go in that block.

> Thank you for your help,  
> Perry

–  
Rick  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![pedz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/839c29/32.png) [@pedz](https://www.ruby-forum.com/u/pedz)\
**Post date:** [July 2, 2007, 4:52am UTC](https://www.ruby-forum.com/t/redirect-to-puts-me-from-https-to-http/108307/3 "2007-07-02T04:52:07Z")

</div>

Thanks. I was just about to come back and post an update.

I found this link:

[http://blog.innerewut.de/articles/2006/06/21/mongrel-and-rails-behind-apache-2-2-and-ssl](http://blog.innerewut.de/articles/2006/06/21/mongrel-and-rails-behind-apache-2-2-and-ssl)

Thank you again.
