cancel
Showing results for 
Search instead for 
Did you mean: 

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

Megatron9
Nimbostratus
Nimbostratus

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 1

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