Forum Discussion
youssef1
Jul 17, 2018Cumulonimbus
Hi,
the error you see is most likely caused because a previous iRule has already responded the ongoing HTTP request.
After the HTTP request is responded an attempt to modify the HTTP headers will create that kind of TCL exemption.
did you try to combine both irule?
when HTTP_REQUEST {
if { [HTTP::username] eq "" or [HTTP::password] eq "" } {
HTTP::respond 401 WWW-Authenticate "Basic realm=\"AWS Alexa Credentials Required\""
return
}
binary scan [md5 [HTTP::password]] H* password
log local0. "Pw [HTTP::password] MD5 is $password"
if { [class lookup "[HTTP::username]" AWS-Alexa_QA_Account] equals $password } {
log local0. "User [HTTP::username] has been authorized to access virtual server [virtual name]"
} else {
log local0. "User [HTTP::username] has been denied access to virtual server [virtual name] using password [$password]"
HTTP::respond 401 WWW-Authenticate "Basic realm=\"AWS Alexa Credentials Required\""
return
}
STREAM::disable
HTTP::header remove "Accept-Encoding"
}
when HTTP_RESPONSE {
STREAM::disable
log local0. "Adjusting values"
STREAM::expression {@:443@@ @pl-ts-esb-esb01.dev.psegliny@esb-qa-secure-aws.psegliny.com@ @pl-ts-esb-esb02.dev.psegliny@esb-qa-secure-aws.psegliny.com@ @pl-ts-esb-esb03.dev.psegliny@esb-qa-secure-aws.psegliny.com@ @pl-ts-esb-esb04.dev.psegliny@esb-qa-secure-aws.psegliny.com@}
STREAM::enable
}
Last point, you ca notice that i add a return in irule above as specify below:
else {
log local0. "User [HTTP::username] has been denied access to virtual server [virtual name] using password [$password]"
HTTP::respond 401 WWW-Authenticate "Basic realm=\"AWS Alexa Credentials Required\""
return
}