# HTTPS-to-HTTPS redirect

**URL:** <https://community.f5.com/t/https-to-https-redirect/958>\
**Category:** Technical Forums\
**Tags:** dev, irules, v4, devops, application-delivery\
**Created:** [February 15, 2007, 10:13pm UTC](https://community.f5.com/t/https-to-https-redirect/958 "2007-02-15T22:13:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Davean\_Hosang\_1](https://avatars.discourse-cdn.com/v4/letter/d/bbce88/32.png) [@Davean\_Hosang\_1](https://community.f5.com/u/Davean_Hosang_1)\
**Post date:** [February 15, 2007, 10:13pm UTC](https://community.f5.com/t/https-to-https-redirect/958/1 "2007-02-15T22:13:46Z")

</div>

Hello,

I am trying to redirect an https URL to another https URL and am not able to. Can someone let me know if this is possible? My rule scenarios are below.

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

virtual 12.x.x.x:443 unit 1 {

use rule RDC-Redirect-test

rule RDC-Redirect-test {

if (http\_host contains “[app.domain1.com](http://app.domain1.com)”) {

redirect to “[https://myapps.domain2.com/%u](https://myapps.domain2.com/%25u)”

}

else {

discard

}

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

virtual 12.x.x.x:443 unit 1 {

use rule RDC-Redirect-test

}

rule RDC-Redirect-test {

redirect to “[https://myapps.domain2.com/%u](https://myapps.domain2.com/%25u)”

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

---

<div class="post-metadata">

**Author:** ![Martin\_Machacek](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Martin\_Machacek](https://community.f5.com/u/Martin_Machacek)\
**Post date:** [February 16, 2007, 12:55am UTC](https://community.f5.com/t/https-to-https-redirect/958/2 "2007-02-16T00:55:30Z")

</div>

Davean,

this cannot work unless you first decrypt the SSL. The rule parser cannot match the HTTP Host header (which is what the http\_host directive is looking for) in the encrypted content. The connection has to be handled by SSL proxy using your virtual as a back-end. The configuration may look like this:

```tcl
rule RDC-Redirect-test {
   if (http_host contains "app.domain1.com") {
      redirect to "https://myapps.domain2.com/%u"
   }
   else {
       discard
   }
}
virtual 127.0.0.1:8888 unit 1 {
   use rule RDC-Redirect-test
}
proxy 12.x.x.x:443 unit 1 {
   target virtual 127.0.0.1:8888
   clientssl enable   
   clientssl key 
   clientssl cert 
}

```

Caveats: you either need to move the certificate from your server to the BIG-IP or get a new one.

---

<div class="post-metadata">

**Author:** ![Davean\_Hosang\_1](https://avatars.discourse-cdn.com/v4/letter/d/bbce88/32.png) [@Davean\_Hosang\_1](https://community.f5.com/u/Davean_Hosang_1)\
**Post date:** [February 16, 2007, 1:14am UTC](https://community.f5.com/t/https-to-https-redirect/958/3 "2007-02-16T01:14:27Z")

</div>

I figured the encryption had something to do with it. unfortunately another certificate is not an option right now. I appreciate the info. This was a great of help!! Thanks!

---

<div class="post-metadata">

**Author:** ![Davean\_Hosang\_1](https://avatars.discourse-cdn.com/v4/letter/d/bbce88/32.png) [@Davean\_Hosang\_1](https://community.f5.com/u/Davean_Hosang_1)\
**Post date:** [February 16, 2007, 12:33pm UTC](https://community.f5.com/t/https-to-https-redirect/958/4 "2007-02-16T12:33:55Z")

</div>

Actually, I took what you said and created a self signed certificate. since it redirected the request I didn’t get prompt that this certificate was not valid, which is what I didn’t want my users to see.

Thanks for the direction/resolution!
