Need help to write irule
got confused with irule
I am currently right a irule but not getting an expected output.
used the concept from irule of f5 201 courses
when the client makes a request on https://xyzs.anc.vtc.com/credentialmanager or https://xyzs.anc.vtc.com/credentailAPIservice so the request should get redirect to https://cm.login.abc.com -with 192.168.1.x
but I want my URL should remain the same https://xyzs.anc.vtc.com/credentialmanager or https://xyzs.anc.vtc.com/credentailAPIservice
currently, I am using redirect irule but not getting the output as required
I don't think it is possible for your url to remain the same after you use HTTP redirect as it is the idea HTTP redirect. Use a pool command for this and add all the nodes that are with FQDN cm.login.abc.com in that pool. See : https://clouddocs.f5.com/api/irules/pool.html
If you want the hosts to change from cm.login.abc.com to xyzs.anc.vtc.com then but the URI to remain the same /CredentialApiService /CerdentialManager or then use HTTP redirect your irule should look like HTTP::redirect "https://cm.login.abc.com/CredentialApiService" or HTTP::redirect "https://cm.login.abc.com/CerdentialManager"
Also I see for equals "CerdentialManager" it should be equals "/CerdentialManager" as you missed to add "/" at the start. You may also add a default pool under the VIP if you have not added one if nothing matches this pool willl andle it.
Also HTTP redirect or selecting a pool based on hostname, URI or pool can be done nowadays with local traffic policy, so better use tem as they are better optimized than the iRules:
https://support.f5.com/csp/article/K26312346
Edit(I forgot to add):
You may also test the command irule ''virtual'' for internally redirecting traffic from one vip to another vip on the same F5 device but it does not work in some cases. Search devcentral discussions about the irule ''virtual'' command:
https://clouddocs.f5.com/api/irules/virtual.html
Example discussion:
https://devcentral.f5.com/s/question/0D51T00006i7kHX/irule-to-redirect-to-another-vs-on-the-same-ltm