# local HTTP auth looping?  HELP!!!

**URL:** <https://community.f5.com/t/local-http-auth-looping-help/30762>\
**Category:** Technical Forums\
**Tags:** dev, irules, devops, application-delivery\
**Created:** [December 6, 2012, 6:44pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762 "2012-12-06T18:44:34Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Knights\_44](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@Jeff\_Knights\_44](https://community.f5.com/u/Jeff_Knights_44)\
**Post date:** [December 6, 2012, 6:44pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762/1 "2012-12-06T18:44:34Z")

</div>

I recently built a simple irule to do a local HTTP authentication from a datagroup which would block the public from seeing a beta website.

I have watched the logs and it says "User XXX has been authorized to access virtual server /Common/TEST\_SERVER

so it seems the irule is working correctly but the website never comes up, the userid and password screen keep coming up as if in a loop. any suggestions?

here is the irule:

when HTTP\_REQUEST {

binary scan [md5 [HTTP::password]] H\* password

if { [class lookup “[HTTP::username]” datagroup\_xxx] equals $password } {

log local0. “User [HTTP::username] has been authorized to access virtual server [virtual name]”

Insert iRule-based application code here if necessary

} else {

if { [string length [HTTP::password]] != 0 } {

log local0. "User [HTTP::username] has been denied access to virtual server "

}

HTTP::respond 401 WWW-Authenticate “Basic realm=\“local.loc\””

}

}

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [December 6, 2012, 7:10pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762/2 "2012-12-06T19:10:42Z")

</div>

Hi Jeff,

Can you try this?

```tcl
when HTTP_REQUEST {

if {[HTTP::password] eq ""}{

HTTP::respond 401 WWW-Authenticate "Basic realm=\"local.loc\""
} else {
binary scan [md5 [HTTP::password]] H* password
if { [class lookup "[HTTP::username]" datagroup_xxx] equals $password } {
log local0. "User [HTTP::username] has been authorized to access virtual server [virtual name]"

 Insert iRule-based application code here if necessary
} else {
HTTP::respond 403 content "blocked!"
}
}
}

```

Aaron

---

<div class="post-metadata">

**Author:** ![Jeff\_Knights\_44](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@Jeff\_Knights\_44](https://community.f5.com/u/Jeff_Knights_44)\
**Post date:** [December 6, 2012, 7:20pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762/3 "2012-12-06T19:20:49Z")

</div>

it came back with:

The website declined to show this webpage

---

<div class="post-metadata">

**Author:** ![Jeff\_Knights\_44](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@Jeff\_Knights\_44](https://community.f5.com/u/Jeff_Knights_44)\
**Post date:** [December 6, 2012, 7:22pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762/4 "2012-12-06T19:22:23Z")

</div>

and the F5 logs showed:

User XXX has been authorized to access virtual server /Common/XXXXXXXXXX

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [December 6, 2012, 7:30pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762/5 "2012-12-06T19:30:25Z")

</div>

If you take the iRule off of the virtual server are you able to access the pool?

Aaron

---

<div class="post-metadata">

**Author:** ![Jeff\_Knights\_44](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@Jeff\_Knights\_44](https://community.f5.com/u/Jeff_Knights_44)\
**Post date:** [December 6, 2012, 7:33pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762/6 "2012-12-06T19:33:14Z")

</div>

i just noticed something, the second time the userid/password auth screen comes back is says something about “Sling (Development)” which is not us.

---

<div class="post-metadata">

**Author:** ![Jeff\_Knights\_44](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@Jeff\_Knights\_44](https://community.f5.com/u/Jeff_Knights_44)\
**Post date:** [December 6, 2012, 7:34pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762/7 "2012-12-06T19:34:33Z")

</div>

yes, if you take the irule off it goes where it should… one of our websites

---

<div class="post-metadata">

**Author:** ![Jeff\_Knights\_44](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@Jeff\_Knights\_44](https://community.f5.com/u/Jeff_Knights_44)\
**Post date:** [December 6, 2012, 7:40pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762/8 "2012-12-06T19:40:27Z")

</div>

can you see an attachment i just attached ?

---

<div class="post-metadata">

**Author:** ![Jeff\_Knights\_44](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@Jeff\_Knights\_44](https://community.f5.com/u/Jeff_Knights_44)\
**Post date:** [December 6, 2012, 7:42pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762/9 "2012-12-06T19:42:12Z")

</div>

can you see this attachment?

server.jpg

---

<div class="post-metadata">

**Author:** ![Jeff\_Knights\_44](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@Jeff\_Knights\_44](https://community.f5.com/u/Jeff_Knights_44)\
**Post date:** [December 6, 2012, 7:43pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762/10 "2012-12-06T19:43:50Z")

</div>

ok, one more time…

---

<div class="post-metadata">

**Author:** ![Jeff\_Knights\_44](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@Jeff\_Knights\_44](https://community.f5.com/u/Jeff_Knights_44)\
**Post date:** [December 6, 2012, 8:01pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762/11 "2012-12-06T20:01:09Z")

</div>

I am quickly thinking everything is working as it should but the website sees the AUTH request and somehow the JAVA on the site is reacting…

---

<div class="post-metadata">

**Author:** ![Jeff\_Knights\_44](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@Jeff\_Knights\_44](https://community.f5.com/u/Jeff_Knights_44)\
**Post date:** [December 6, 2012, 8:25pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762/12 "2012-12-06T20:25:18Z")

</div>

I cleared all caches

I took the irule out of the VIP

the website came up with no problem

I put your irule back in, and its not saying blocked or anything, its just looping the userid and password again..

so now I am back to square one.

---

<div class="post-metadata">

**Author:** ![Jeff\_Knights\_44](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@Jeff\_Knights\_44](https://community.f5.com/u/Jeff_Knights_44)\
**Post date:** [December 6, 2012, 8:32pm UTC](https://community.f5.com/t/local-http-auth-looping-help/30762/13 "2012-12-06T20:32:49Z")

</div>

would cookie persistence make any difference?
