Forum Discussion
Insert Basic Auth Header
- Sep 14, 2022
One thought that comes to mind is that you might be able to do a simple header injection via the HTTP profile or via an iRule. I do want to note that this design would allow any client to connect to your web application as whatever user is provided in the header, so it would not necessarily be much better than regular anonymous usage. Further, the password is only encoded with base64, so is essentially the same as clear text, you will want to use SSL/TLS to protect the communication.
To build the authorization string, combine the username and password, separated by a colon, and then base64 encode the whole string. For example RFC7617 shows the username Aladdin with password 'open sesame', which results in the base64 string QWxhZGRpbjpvcGVuIHNlc2FtZQ==. Be sure to come up with the value required for your implementation. CyberChef is a handy tool to do base64 operations.
In the HTTP profile, set the Request Header Insert value to:
Authorization Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
In an iRule, this might look like this. (I haven't tested this):
when HTTP_REQUEST_RELEASE { HTTP::header insert Authorization "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" }
Last note: that this method might not work if the application server is expecting to respond with a 401 error first and then have the user authenticate second. You would need additional logic in that case.
Thanks,
Josh Becigneul
There are websocket profiles. So you might use the default one or create a new one.
here you have more info:
https://my.f5.com/manage/s/article/K14754
- Nathan_Houck_65May 02, 2012
Nimbostratus
Im assuming your using verion 10.x - DaveC_53879May 02, 2012
Nimbostratus
Thanks for responding. Actually I'm running 9.4.6, and "b verify load bigip.conf" returns the same error. - Nathan_Houck_65May 02, 2012
Nimbostratus
I was able to do a b verify load on a10.2.3 box with the short rule name and syntax below. It may be worth it, to blow away the Irule and put it back in in order to rule out syntax. - DaveC_53879May 02, 2012
Nimbostratus
Nathan, I did as you suggested but it made no difference. I then deleted/recreated the rule with a much shorter name, which didn't help either. Any other ideas? - Nathan_Houck_65May 02, 2012
Nimbostratus
You could try to open a case with F5 support to further troubleshoot this issue but they may or may/not help because this is for an Irule. Opening a case might help if you are running into a software bug. Personally, I would take the rule of the conf file completly using VI. Then do "b verify load" If it looks good, Configsync, then trying putting the Irule back in using the GUI. - Joel_MosesMay 02, 2012
Nimbostratus
9.4.6 had some oddities about placement of curly-braces in iRules. Try this:when HTTP_REQUEST { switch -glob [string tolower [HTTP::host]] { "www.site1.com" - "site1.com" { HTTP::redirect "http://www.site-1.com[HTTP::uri]" } } }
- DaveC_53879May 03, 2012
Nimbostratus
The double quotes fixed the issue. Thanks to all of you for your responses and suggestions. Any day you learn something new is a good day. Dave
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com