summaryrefslogtreecommitdiff
path: root/doc/bugs
diff options
context:
space:
mode:
authorhttp://kerravonsen.dreamwidth.org/ <http://kerravonsen.dreamwidth.org/@web>2011-03-21 03:08:39 +0000
committerJoey Hess <joey@kitenet.net>2011-03-21 03:08:39 +0000
commit67ddc34fbcb22c4cd7174c35c8695a21de82eeef (patch)
tree57c3ec349069b14111bf5b40316ea58d0b87f852 /doc/bugs
parentefd9207e432ab8aa21fac8b8a4827624b2af7e3c (diff)
problem with reverse proxy and searching
Diffstat (limited to 'doc/bugs')
-rw-r--r--doc/bugs/trouble_with_base_in_search.mdwn43
1 files changed, 43 insertions, 0 deletions
diff --git a/doc/bugs/trouble_with_base_in_search.mdwn b/doc/bugs/trouble_with_base_in_search.mdwn
new file mode 100644
index 000000000..16e4e7468
--- /dev/null
+++ b/doc/bugs/trouble_with_base_in_search.mdwn
@@ -0,0 +1,43 @@
+For security reasons, one of the sites I'm in charge of uses a Reverse Proxy to grab the content from another machine behind our firewall.
+Let's call the out-facing machine Alfred and the one behind the firewall Betty.
+
+For the static pages, everything is fine. However, when trying to use the search, all the links break.
+This is because, when Alfred passes the search query on to Betty, the search result has a "base" tag which points to Betty, and all the links to the "found" pages are relative.
+So we have
+
+ <base href="Betty.example.com"/>
+ ...
+ <a href="./path/to/found/page/">path/to/found/page</a>
+
+This breaks things for anyone on Alfred, because Betty is behind a firewall and they can't get there.
+
+What would be better is if it were possible to have a "base" which didn't reference the hostname, and for the "found" links not to be relative.
+Something like this:
+
+ <base href="/"/>
+ ...
+ <a href="/path/to/found/page/">path/to/found/page</a>
+
+The workaround I've come up with is this.
+
+1. Set the "url" in the config to '&nbsp;' (a single space). It can't be empty because too many things complain if it is.
+2. Patch the search plugin so that it saves an absolute URL rather than a relative one.
+
+Here's a patch:
+
+ diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm
+ index 3f0b7c9..26c4d46 100644
+ --- a/IkiWiki/Plugin/search.pm
+ +++ b/IkiWiki/Plugin/search.pm
+ @@ -113,7 +113,7 @@ sub indexhtml (@) {
+ }
+ $sample=~s/\n/ /g;
+
+ - my $url=urlto($params{destpage}, "");
+ + my $url=urlto($params{destpage}, undef);
+ if (defined $pagestate{$params{page}}{meta}{permalink}) {
+ $url=$pagestate{$params{page}}{meta}{permalink}
+ }
+
+It works for me, but it has the odd side-effect of prefixing links with a space. Fortunately that doesn't seem to break browsers.
+And I'm sure someone else could come up with something better and more general.