Forum Discussion

Marvel's avatar
Marvel
Icon for Nimbostratus rankNimbostratus
Apr 25, 2019

Strip http origin header

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

 

  • Marvel's avatar
    Marvel
    Icon for Nimbostratus rankNimbostratus

    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" } }

     

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

      Cheers.

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

    Here's a version with corrected syntax:

    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.

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

    HTTP_RESPONSE
    event instead of
    HTTP_REQUEST
    .