# /admin in https

**URL:** <https://www.ruby-forum.com/t/admin-in-https/69357>\
**Category:** Typo\
**Created:** [September 20, 2006, 3:26pm UTC](https://www.ruby-forum.com/t/admin-in-https/69357 "2006-09-20T15:26:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@Beber](https://www.ruby-forum.com/u/Beber)\
**Post date:** [September 20, 2006, 3:26pm UTC](https://www.ruby-forum.com/t/admin-in-https/69357/1 "2006-09-20T15:26:46Z")

</div>

Hi,

Is there a way to make the /admin into https and everything else in http  
?

Thanks

---

<div class="post-metadata">

**Author:** ![Beber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@Beber](https://www.ruby-forum.com/u/Beber)\
**Post date:** [September 21, 2006, 3:42am UTC](https://www.ruby-forum.com/t/admin-in-https/69357/2 "2006-09-21T03:42:22Z")

</div>

On Wednesday 20 September 2006 21:10, Beber wrote:

> Hi,
> 
> Is there a way to make the /admin into https and everything else in http ?

I do this on the Apache side using redirects, but it isn’t pretty.

TX

---

<div class="post-metadata">

**Author:** ![Beber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@Beber](https://www.ruby-forum.com/u/Beber)\
**Post date:** [September 21, 2006, 3:25pm UTC](https://www.ruby-forum.com/t/admin-in-https/69357/3 "2006-09-21T15:25:50Z")

</div>

Trejkaz [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> On Wednesday 20 September 2006 21:10, Beber wrote:
> 
> > Hi,
> > 
> > Is there a way to make the /admin into https and everything else in http ?
> 
> I do this on the Apache side using redirects, but it isn’t pretty.

I tried that and with ProxyPass setting and it only fails. Could you  
paste me your redirection ?

Thnaks

---

<div class="post-metadata">

**Author:** ![Beber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@Beber](https://www.ruby-forum.com/u/Beber)\
**Post date:** [September 21, 2006, 7:36pm UTC](https://www.ruby-forum.com/t/admin-in-https/69357/4 "2006-09-21T19:36:52Z")

</div>

On 9/21/06, Beber [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> paste me your redirection ?  
> Sooner or later I’d like to make this a config option–if it’s set,  
> then Typo generates all /admin URLs with https://. That’d probably be  
> easier. Feel free to submit a patch :-).

Scott

---

<div class="post-metadata">

**Author:** ![Beber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@Beber](https://www.ruby-forum.com/u/Beber)\
**Post date:** [September 22, 2006, 1:43am UTC](https://www.ruby-forum.com/t/admin-in-https/69357/5 "2006-09-22T01:43:43Z")

</div>

Scott,

I believe that the rails team has already done this for you 🙂

In the the httpd.conf in your \<VirtualHost \*:443\> record add this

RequestHeader set X\_FORWARDED\_PROTO “https”

Then all of your url\_for() will correctly render https or http depending  
on  
the RequestHeader parameter

I’m not a sys admin … Nor do I play on on TV… This is where I  
learned  
about this little gem. (Also I should mention that we are running  
apache 2/  
Mongrel Rails)

[http://www.planetrubyonrails.org/show/feed/60](http://www.planetrubyonrails.org/show/feed/60)

-Linda D.

---

<div class="post-metadata">

**Author:** ![Beber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@Beber](https://www.ruby-forum.com/u/Beber)\
**Post date:** [September 22, 2006, 1:49am UTC](https://www.ruby-forum.com/t/admin-in-https/69357/6 "2006-09-22T01:49:43Z")

</div>

In my case we turned the entire site into https, so that solved my  
problem.

(Did I mention that I’m not a sysadmin 🙂  
where is the flaw in this logic?  
Add proxy pass for /admin /accounts in the \*:80 record to the https  
urls.  
Add the X\_FORWARDED\_PROTO to the :443 record.

My thought is that if rails produces a /admin or /accounts url with http  
then the proxypasses will convert it to https.

Unless your point is that once in https there is no way to return to  
http?  
So you would end up putting proxypasses in https to point /articles etc  
to  
http.

-Linda

---

<div class="post-metadata">

**Author:** ![Beber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@Beber](https://www.ruby-forum.com/u/Beber)\
**Post date:** [September 22, 2006, 1:47am UTC](https://www.ruby-forum.com/t/admin-in-https/69357/7 "2006-09-22T01:47:43Z")

</div>

That’s part of the issue, but it’d be nice if _every_ link to /admin  
(or /accounts) used https while non-authenticated links still use  
http. That’s a bit harder to do from Apache.

Scott

---

<div class="post-metadata">

**Author:** ![Beber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@Beber](https://www.ruby-forum.com/u/Beber)\
**Post date:** [October 1, 2006, 11:58am UTC](https://www.ruby-forum.com/t/admin-in-https/69357/8 "2006-10-01T11:58:33Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

On 22/09/2006, at 05:23 AM, Scott L. wrote:

> That’s part of the issue, but it’d be nice if _every_ link to /admin  
> (or /accounts) used https while non-authenticated links still use  
> http. That’s a bit harder to do from Apache.

Part of the problem I had with this kind of trick from Apache was  
that the admin interface still links to various resources  
(stylesheets, image files) which are outside the /admin URL scheme.  
So I had to put in a whole set of extra rules to make those ones not  
auto-redirect back to http:, otherwise browsers would give a bunch of  
security warnings (displaying non-secure resource from secure page,  
etc.)

TX

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFFH2PpuMe8iwN+6nMRAjxGAJkBBF2+c6bpEVuHwreOf8f64OWu3wCeNVRS  
BhUODYxqS2YLtufJIM0IlO0=  
=FbEW  
-----END PGP SIGNATURE-----
