summaryrefslogtreecommitdiff
path: root/httpexists-proxy.php
diff options
context:
space:
mode:
Diffstat (limited to 'httpexists-proxy.php')
-rwxr-xr-xhttpexists-proxy.php20
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