# Redirection http to https

**URL:** <https://community.f5.com/t/redirection-http-to-https/48826>\
**Category:** Technical Forums\
**Tags:** asm-advanced-waf, big-ip, security\
**Created:** [September 23, 2020, 6:22pm UTC](https://community.f5.com/t/redirection-http-to-https/48826 "2020-09-23T18:22:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mika](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@mika](https://community.f5.com/u/mika)\
**Post date:** [September 23, 2020, 6:22pm UTC](https://community.f5.com/t/redirection-http-to-https/48826/1 "2020-09-23T18:22:28Z")

</div>

Hello, Need helps

So, I want to redirect my host http to https.

To do , I tried the different soltions propoesed by F5 such as :

the irule :

when HTTP\_REQUEST {

if { ([HTTP::host] equals “[abc.com](http://abc.com)”) } {

if {[HTTP::has\_responded]}{return}

log local0. “[HTTP::host] [HTTP::uri]”

HTTP::respond 301 Location “https://[HTTP::host][HTTP::uri]”

regsub -all {:\d\*$} [HTTP::host] “” host

HTTP::redirect https://$host[HTTP::uri]

return

}

}

and:

when HTTP\_REQUEST {

if { ([HTTP::host] equals “[abc.com](http://abc.com)”) }

{&nbsp;&nbsp;HTTP::respond 301 Location “https://[HTTP::host][HTTP::uri]”}

}

and

when HTTP\_REQUEST {

if { ([HTTP::host] equals “[abc.com](http://abc.com)”) }

{&nbsp;&nbsp;HTTP::redirect “https://[HTTP::host][HTTP::uri]”}

}

I also tested the policy LTM.

in both test, I got the same probleme : so the redirection don’t work in some browser : for few minutes i get an error conexion reset.

if one of you has ever had to deal with this , please tell me what to do !

best regards,

---

<div class="post-metadata">

**Author:** ![Samir](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/samir/32/13073_2.png) [@Samir](https://community.f5.com/u/Samir)\
**Post date:** [September 27, 2020, 6:48am UTC](https://community.f5.com/t/redirection-http-to-https/48826/2 "2020-09-27T06:48:09Z")

</div>

Don’t see issue on iRule. I suspecting issue on something else.

Did your application works with https?

- Try to validate via [https://abc.com](https://abc.com) on browser
- Validate the connectivity from F5 device via curl command
- I would encourage to use F5 provided redirection irule " **\_sys\_https\_redirect"** rather then fancy.

Hope it will help to isolate the issue.
