For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Megatron9's avatar
Megatron9
Icon for Nimbostratus rankNimbostratus
Feb 16, 2022

IRule to pass/inject "URL in Header" with "API Key" for authentication

Hi,

I am working on an IRule to inject a URL in the header and passing an API Key for authentication.

daxalerts-api.daxch.com/interfiling

us-east-1 configuration

◦ URL: https://eastdax-api.us-east-1.amazonaws/interfiling
◦ API Key: rbvMCKTq47ncSZuxrmUN4yWnfRaSFfzz

◦ Example:
wget https://eastdax-api.us-east-1.amazonaws/interfiling --header='x-api-key:rbvMCKTq47ncSZuxrmUN4yWnfRaSFfzz' --header='Content-Type:text/plain' --post-data '{ }' -d

 

-------------------

when HTTP_REQUEST {

if { HTTP::header insert [HTTP::host] equals"https://eastdax-api.us-east-1.amazonaws/interfiling"} {
set key "rbvMCKTq47ncSZuxrmUN4yWnfRaSFfzz"

}

-----------------------------

The above does not work and its basically become a pass-thru.

 

Thanks

1 Reply

  • Hi Megatron9,

    Can you try this iRule?

    when HTTP_REQUEST {
    	if { [HTTP::host] eq "eastdax-api.us-east-1.amazonaws" && [HTTP::uri] eq "/interfiling" } {
    		HTTP::header insert "x-api-key" "rbvMCKTq47ncSZuxrmUN4yWnfRaSFfzz"
    	}
    }