Forum Discussion
is it possible to log all header to html page
- Apr 12, 2021
1.You can just add the log local0 in statement in the foreach loop and not write all the headers to "LogString" variable like log local0. "$headerName:[HTTP::header value $headerName]" or you can still use "LogString" but without the "append" as this time it will just take the value of the firt header and log it, then the second and then the 3th header and value and so on.
2.Also you can also research the Split string ?splitChars? to split the string in a list before logging the output "LogString" variable, so that you can make it a list (you add something like "#" after each append of the HTTP header and value and use it as match for the split string) beffore logging it out but the previous example is easyer.
Use of manipulations like "Split string" etc.:
https://devcentral.f5.com/s/articles/irules-101-15-tcl-list-handling-commands
I suggest reading the F5 devcental course on irules, so that you can work better with irules. After that play writting irules and in no time you are good to go as I see you are playng with them but just need some more time.
The order of things in an event like "HTTP_REQUEST" is important try placing the genaration of the custom response Page at the end of the combine irule outside of the foreach loop.
Also for a response just use "HTTP_RESPONSE" as an event not "HTTP_REQUEST" and only use the irule to log the headers to the ltm log, not the combine irule as generating a custom respnse page to the servers is not going to work (they don't want it as this is how HTTP works.).
But know that if you attach the two irules under the same VIP for logging the HTTP headers in the request and generating custom response page and the irule for logging the server response headers, when the clieny matches the iRule with "HTTP_REQUEST" that generates custom page, you may not see the server pool member response as the F5 is generating the custom page and responding to the client before even a HTTP response is given by the the real server but I don't know what you are trying to do. If you add the two irules under the same VIP better use if else condition to send the custom response page to the clients just in some cases, so that the real pool member server could be asked for a response.
Also better read more about irules as you will need this knowedge to write irules on your own:
https://devcentral.f5.com/s/articles/irules-101-01-introduction-to-irules
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