Forum Discussion
Apr 25, 2011
Response redirect ONLY if browser URI gives an 404 error
Hello All, How does one redirect to an external URL in the response ONLY if the URI in the browser returns a 404? ex) When you hit a page and the URL in the browser is "http://xyz.co...
Kurt_Knochner_5
Nov 02, 2011Cirrus
Posted By trx on 06/11/2011 12:50 AM
I think this is better if I show an image of the browser. I only care if the 1 URL returns a 404 and do NOT care if the relative image URL 2 returns a 404.
If 1 returns a 404, then redirect to custom 404 page.
If 1 returns a 200, but 2 returns a 404, do NOT redirect anywhere.
So the goal is to get a hold of the 1 URL and check if it returns a 404 or NOT.
Hi,
maybe there is a misconception how the LB works in this context.
Let me explain what I mean: The browser loads the inital page, which contains HTML code. Within that HTML code there are references to images, css, javascript, etc. The browser then requests that content, one by one. That's all totally unrelated HTTP requests for the LB. Thus, the LB has no idea what parts (images, etc.) belong to one web page. The browser knows that, but not the LB. So, there is no easy way to intercept 404 errors if multiple conditions have to apply (as you described).
Actually it's up to you to tell the LB every single URL where you want to catch 404 errors (which are coming from the web server). As I said, there is no easy way to do that conditionally, only if "this and that happend" as well "on that page".
Maybe I don't fully understand what you want to do. Why is it important to intercept a 404 error for an image only if another image did not generate a 404??
Regards
Kurt Knochner
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects