Forum Discussion
iRule HTML Maintenance Page insert URI Value
Looking for help writing an iRule that will display, in HTML code, that the page being access has been changed. I'm trying to figure out how to referece the requested URI in HTML since this will vary. Below is what I have for now. Any help is appriciated.
when HTTP_REQUEST {
HTTP::respond 200 content {
<html>
<head>
<title> This Page Has Moved </title>
</head>
<body>
<b> This Page Has Moved </b>
Links and bookmarks to example.com should be updated to example.new.com
The page you requested has moved to https://example.com/<HTTP::uri>
</body>
</html>
}
}
__PRESENT
__PRESENT
__PRESENT
__PRESENT
__PRESENT
Some guidance here. You can use iFiles on F5 to upload your HTML and then serve via an iRule. Easier to maintain!
https://clouddocs.f5.com/api/irules/iFile.html
Finally, you can use HTTP meta tags to try and have the browser auto redirect after a certain time period. Check out the previous post on this:
Using both resources, you should be able to set this up in no time 🙂
Some guidance here. You can use iFiles on F5 to upload your HTML and then serve via an iRule. Easier to maintain!
https://clouddocs.f5.com/api/irules/iFile.html
Finally, you can use HTTP meta tags to try and have the browser auto redirect after a certain time period. Check out the previous post on this:
Using both resources, you should be able to set this up in no time 🙂
Oh yeah, for namespace reference, you can store into a variable and then use in a string:
https://community.f5.com/t5/technical-articles/intermediate-irules-handling-strings/ta-p/290304
Otherwise, you can access directly in a string using the brackets...
something here like log.local0 or whatever... "your uri is [HTTP::uri]"
fwadmin Do you plan on owning the old domain still once it has migrated? If you will keep the old domain I would bother with this page and would just perform a 301 redirect and leave it be. You might be able to add in an additional action to add in a referer HTTP header and allow the destination server to add in a pop-up saying the site changed and when the old name will no longer be used.
- fwadminAltostratus
Thanks for the reply. Yes, totally agree, so a redirect is what was first thought, but we want users to update their bookmarks and give them some time to do that; we wont be keeping the old domain. So is it even possible to display the URI and or URL in the html code or would it be easier to just add a popup after redirected if they went to the old URL?
fwadmin I would recommend doing the popup on the receiving server so that your iRule remains simple. Remember, just because the F5 can do it doesn't mean it's the best option.
- fwadminAltostratus
Thanks for the help! We ended up using the iFile option for the HTML portion of the page then defining a variable in the iRule for the URL and URI and refreceng those variable with $var_name.
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