# Strip http origin header

**URL:** <https://community.f5.com/t/strip-http-origin-header/56122>\
**Category:** Technical Forums\
**Tags:** irules, devops, application-delivery\
**Created:** [April 25, 2019, 1:12am UTC](https://community.f5.com/t/strip-http-origin-header/56122 "2019-04-25T01:12:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marvel](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@Marvel](https://community.f5.com/u/Marvel)\
**Post date:** [April 25, 2019, 1:12am UTC](https://community.f5.com/t/strip-http-origin-header/56122/1 "2019-04-25T01:12:50Z")

</div>

Can anyone please provide me the iRule to strip the “origin” header from http response

I used an iRule to remove but it is removing it from the response but I need it deleted from the request

---

<div class="post-metadata">

**Author:** ![Marvel](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@Marvel](https://community.f5.com/u/Marvel)\
**Post date:** [April 25, 2019, 1:18am UTC](https://community.f5.com/t/strip-http-origin-header/56122/2 "2019-04-25T01:18:17Z")

</div>

This is the iRule that I am using right now:

when HTTP\_REQUEST { if { [HTTP::header value “Origin”] starts\_with "; } then { HTTP::header remove “Origin” } }

---

<div class="post-metadata">

**Author:** ![rob\_carr](https://avatars.discourse-cdn.com/v4/letter/r/a87d85/32.png) [@rob\_carr](https://community.f5.com/u/rob_carr)\
**Post date:** [April 25, 2019, 3:58am UTC](https://community.f5.com/t/strip-http-origin-header/56122/3 "2019-04-25T03:58:49Z")

</div>

That rule won’t load in v13.1, due to syntax errors.

Here’s a version with corrected syntax:

```tcl
when HTTP_REQUEST { 
    if { [HTTP::header value "Origin"] starts_with "https://abc.com" } { 
        HTTP::header remove "Origin" 
    }
}

```

I can’t see any reason (off the top of my head) why this rule wouldn’t be working (after syntax errors were removed). You might try logging the value of the Origin header to see what clients are actually offering, if you aren’t seeing the expected outcome.

---

<div class="post-metadata">

**Author:** ![CharlesCS](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/charlescs/32/3067_2.png) [@CharlesCS](https://community.f5.com/u/CharlesCS)\
**Post date:** [April 25, 2019, 8:03am UTC](https://community.f5.com/t/strip-http-origin-header/56122/4 "2019-04-25T08:03:57Z")

</div>

If you want to remove this header from the response, use the

```tcl
HTTP_RESPONSE

```

event instead of

```tcl
HTTP_REQUEST

```

.

---

<div class="post-metadata">

**Author:** ![LiefZimmerman](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/liefzimmerman/32/3355_2.png) [@LiefZimmerman](https://community.f5.com/u/LiefZimmerman)\
**Post date:** [January 30, 2020, 11:58pm UTC](https://community.f5.com/t/strip-http-origin-header/56122/5 "2020-01-30T23:58:11Z")

</div>

- either of the below qualify to be **Selected as Best** answer? If so please do.

Cheers.
