diff options
| author | Comment <tim@gray.(none)> | 2013-05-08 22:59:04 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-05-08 22:59:04 +0100 |
| commit | 4f81e9399051cc90ccddeb69b785d7422a28a1ff (patch) | |
| tree | ea5187184ed61114b9315371e5c2d709bdf26c4f /httpexists-proxy.php | |
initial commit
Diffstat (limited to 'httpexists-proxy.php')
| -rwxr-xr-x | httpexists-proxy.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/httpexists-proxy.php b/httpexists-proxy.php new file mode 100755 index 0000000..adc4df4 --- /dev/null +++ b/httpexists-proxy.php @@ -0,0 +1,20 @@ +<?php +// Rough proxy to help map.js check for photos. +// Reason being that requests similar to http://www.tcd.ie/Maps/photos/small/100.jpg +// were being redirected to http://www.tcd.ie/Maps/photos/small/200.jpg or similar. +// Because the web server is set up to permenantly redirect 301 to files with a similar name. +// JavaScript cannot check for redirects (30x) as they are completed before the JavaScript runs. +// Hence maps.js always got a 200 OK response for redirected photos. +if (!empty($_GET['httpexistsurl'])) { + if (file_exists(dirname($_SERVER['SCRIPT_FILENAME']).'/'.$_GET['httpexistsurl'])) { + // all good + } + else { + header("HTTP/1.0 404 Not Found"); + } +} +else { + header("HTTP/1.0 404 Not Found"); +} + +?>
\ No newline at end of file |
