Technical Forum
Ask questions. Discover Answers.
Showing results for 
Search instead for 
Did you mean: 

Need help on irule: External content for internal request in F5


I have a requirement and trying to achive through irule but some how not working as expected..


Client to access Internal URL :

F5 to call the content from this external URL:

Insert external URL content and send back to internal URL as response

I tried this way but not working...


if { [HTTP::host] equals "" } {
# Call the subroutine to handle the internal request and respond to the client

# Subroutine to handle the internal call and response
proc internal_call_and_respond {} {
set backend_response [HTTP::get ""]

set response_status [HTTP::status]
set response_headers [HTTP::header]

# Set the response status code and headers from the backend response
HTTP::respond $response_status [HTTP::header replace $response_headers] -persist {
# Send the backend response content as the body of the client response
echo $backend_response


Thanks in advance...




Community Manager
Community Manager

Have you used log statements to verify expected variable inputs in each section of the iRule? That is the first thing I'd do.

Hi AubreyKing,

Thanks for your response.

While updating this irule, i got below messages...

01070151:3: Rule [/Common/irule-test] error: /Common/irule-test:4: error: [undefined procedure: internal_call_and_respond][internal_call_and_respond]
/Common/irule-test:7: error: [command is not valid in the current scope][proc internal_call_and_respond {} {
set backend_response [HTTP::get ""]
set response_status [HTTP::status]
set response_headers [HTTP::header]


@grmanikantan Based on the log it seems like the subroutine isn't configured properly. Before we go any further with this, what's the requirement that is forcing you to have to take care of this on the F5?

Hi Paul, My requirement is simple. There is one internal URL which is configured in F5 VS, if user hit that URL ( ) F5 should be respond with external content (webpages) which is available in the outside of F5 ( I'm trying various methods subroutine is one of that...

@grmanikantan If you are just forwarding the content of that external site you might be better off configuring a pool with a pool member using the FQDN and then using a string map to replace instances of with before it's set to the the destination. Keep in mind that you will have to enable SNAT for this to work most likely. The stringmap should look something like the following.

when HTTP_REQUEST priority 500 {

    if {[HTTP::uri] starts_with "/public/"} {
        HTTP::host [string map {"" ""}[HTTP::host]]
        pool POOL_ExternalWeb_443


Community Manager
Community Manager

@grmanikantan - If your post was solved it would be helpful to the community to select *Accept As Solution*.
This helps future readers find answers more quickly and confirms the efforts of those who helped.
Thanks for being part of our community.