Forum Discussion
Add rule to vs using Python SDK
I have create a new rule X-Forward and now need to attach it to a virtual server using python SDK
Q: can someone share an example? thanks
1 Reply
- Jason_Cohen_417Historic F5 Account
Are you simply adding an X-Forwarded-For header? If that is all you are doing, you could probably do that with a setting in the HTTP profile.
However, for the sake of answering the "attach a rule" question, this answer may have the information you are looking for.
https://devcentral.f5.com/questions/python-sdk-assign-irules-to-a-virtual-server-51173
Copied here for simplicity.
>>> vip = b.tm.ltm.virtuals.virtual.load(name='testvip') >>>vip.rules [u'/Common/tcptest'] >>> vip.rules = ['/Common/tcptest', '/Common/platform_info'] >>> vip.update() >>vip.rules [u'/Common/tcptest', u'/Common/platform_info']
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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