Forum Discussion

DineshVM_265886's avatar
DineshVM_265886
Icon for Altostratus rankAltostratus
Feb 06, 2017

iRule giving 401 unauthorized error

Hi, Can anyone help me with the below iRule? I am getting a 401 unauthorized error when I use the below iRule but I get a 200 ok without the iRule. Should I include the pool information in the iRule ?

 

when RULE_INIT { set nURI 0 }

 

when HTTP_REQUEST priority 500 {

 

switch -glob [HTTP::uri] {

 

"/" {

 

set nURI [string map {"/" "/v1/"} [HTTP::uri]]

 

}

 

default {

 

set nURI [HTTP::uri]

 

}

 

}

 

HTTP::uri "${nURI}"

 

}

 

1 Reply

  • Can you use CURL to identify the exact response ? The reason you are getting 401 is because your iRule is changing the URI to something that the servers don't understand. I would also recommend using "log local0." statements in order to log the URI before and after the change by iRule. For logging, see here.