# Redirect for ssl

**URL:** <https://www.ruby-forum.com/t/redirect-for-ssl/144369>\
**Category:** Rails\
**Created:** [July 29, 2008, 4:23am UTC](https://www.ruby-forum.com/t/redirect-for-ssl/144369 "2008-07-29T04:23:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbobker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/73ab20/32.png) [@tbobker](https://www.ruby-forum.com/u/tbobker)\
**Post date:** [July 29, 2008, 4:23am UTC](https://www.ruby-forum.com/t/redirect-for-ssl/144369/1 "2008-07-29T04:23:24Z")

</div>

I have two sites: [foo.com](http://foo.com) and [bar.com](http://bar.com) which dns points to the same ip  
and whose contents reside on the same folder. The problem is that i  
purchased a site certificate for only [foo.com](http://foo.com). If ssl\_required redirects  
a user on [bar.com](http://bar.com) to port 443, then they get an error according to their  
browser security settings.

I have thought of several ways to attack this problem, but would like  
some advice.

(1) hard-code my link\_to settings to go to [foo.com](http://foo.com). This is easy, but  
ugly, not maintainable (my testing server would no longer work)

(2) overload ssl\_required to go to [foo.com](http://foo.com) – might be cleaner, but not  
sure how to do this

(3) set up apache or dns to force ssl traffic over [foo.com](http://foo.com) – would be  
most compatible on my ubuntu vps web-server

I am really stuck with this and appreciate your advice.

Thanks,

Tim

p.s. this is lower priority, but in general, I am in a rut  
troubleshooting ssl on my development server since my windows machine  
and webrick are proving difficult to modify.

---

<div class="post-metadata">

**Author:** ![tbobker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/73ab20/32.png) [@tbobker](https://www.ruby-forum.com/u/tbobker)\
**Post date:** [July 29, 2008, 2:49pm UTC](https://www.ruby-forum.com/t/redirect-for-ssl/144369/2 "2008-07-29T14:49:32Z")

</div>

I think SSL requires unique IP. I did something like this few years  
back… thats when I found that you can not assign same IP to SSL and  
non-sercure website. try using diff IP for non-SSL website.

I hope it will help

Ajit

On Jul 28, 10:23 pm, Tim B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![tbobker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/73ab20/32.png) [@tbobker](https://www.ruby-forum.com/u/tbobker)\
**Post date:** [July 29, 2008, 3:42pm UTC](https://www.ruby-forum.com/t/redirect-for-ssl/144369/3 "2008-07-29T15:42:26Z")

</div>

Ajit Singh wrote:

> I think SSL requires unique IP. I did something like this few years  
> back… thats when I found that you can not assign same IP to SSL and  
> non-sercure website. try using diff IP for non-SSL website.
> 
> I hope it will help
> 
> Ajit
> 
> On Jul 28, 10:23 pm, Tim B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Thanks for your reply, but I don’t think I need a new ip. The problem  
here is not getting one ip to serve 80 and 443, but forcing the user on  
[bar.com](http://bar.com) to go to [foo.com](http://foo.com). I am just trying to do that in the most  
elegant way.

thanks!

Tim

---

<div class="post-metadata">

**Author:** ![tbobker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/73ab20/32.png) [@tbobker](https://www.ruby-forum.com/u/tbobker)\
**Post date:** [July 29, 2008, 4:13pm UTC](https://www.ruby-forum.com/t/redirect-for-ssl/144369/4 "2008-07-29T16:13:56Z")

</div>

I would recommend (3) – set up apache to redirect [bar.com](http://bar.com) https  
traffic to [foo.com](http://foo.com) (assuming both sites are identical, it should be  
transparent to the user… I’m assuming this because you said “both  
sites reside in the same folder”.)

On Jul 29, 8:42 am, Tim B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![tbobker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/73ab20/32.png) [@tbobker](https://www.ruby-forum.com/u/tbobker)\
**Post date:** [July 29, 2008, 4:28pm UTC](https://www.ruby-forum.com/t/redirect-for-ssl/144369/5 "2008-07-29T16:28:37Z")

</div>

On Tue, 2008-07-29 at 15:42 +0200, Tim B. wrote:

> > On Jul 28, 10:23 pm, Tim B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> 
> Thanks for your reply, but I don’t think I need a new ip. The problem  
> here is not getting one ip to serve 80 and 443, but forcing the user on  
> [bar.com](http://bar.com) to go to [foo.com](http://foo.com). I am just trying to do that in the most  
> elegant way.

* * *

probably something like this in httpd.conf

RedirectPermanent / [https://foo.com](https://foo.com)

Craig

---

<div class="post-metadata">

**Author:** ![tbobker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/73ab20/32.png) [@tbobker](https://www.ruby-forum.com/u/tbobker)\
**Post date:** [July 29, 2008, 7:05pm UTC](https://www.ruby-forum.com/t/redirect-for-ssl/144369/6 "2008-07-29T19:05:32Z")

</div>

Craig W. wrote:

> On Tue, 2008-07-29 at 15:42 +0200, Tim B. wrote:
> 
> > > On Jul 28, 10:23 pm, Tim B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> > 
> > Thanks for your reply, but I don’t think I need a new ip. The problem  
> > here is not getting one ip to serve 80 and 443, but forcing the user on  
> > [bar.com](http://bar.com) to go to [foo.com](http://foo.com). I am just trying to do that in the most  
> > elegant way.
> 
> * * *
> 
> probably something like this in httpd.conf
> 
> RedirectPermanent / [https://foo.com](https://foo.com)
> 
> Craig

So you think an apache solution is better than a rails solution. If we  
did a rails solution, what would it be?

best,

tim
