]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/want_to_avoid_ikiwiki_using_http_or_https_in_urls_to_allow_serving_both.mdwn
cbd8c4da7cd32327b1ee39feef560312761b1ad8
[ikiwiki.git] / doc / todo / want_to_avoid_ikiwiki_using_http_or_https_in_urls_to_allow_serving_both.mdwn
1 It looks like all links in websites are absolute paths, this has some limitations:
2
3 * If connecting to website via https://... all links will take you back to http://
4 * Makes it harder to mirror website via HTML version, as all links have to be updated.
5
6 It would be good if relative paths could be used instead, so the transport method isn't changed unless specifically requested.
7
8 -- Brian May
9
10 > Er, which absolute links are you talking about? If you view the source
11 > to this page, you'll find links such as "../favicon.ico", "../style.css",
12 > "../../", and "../". The only absolute links are to CGIs and the w3c DTD.
13 > --[[Joey]]
14
15 >> The problem is within the CGI script. The links within the HTML page are all
16 >> absolute, including links to the css file. Having a http links within a HTML
17 >> page retrieved using https upset most browsers (I think). Also if I push cancel
18 >> on the edit page in https, I end up at at http page. -- Brian May
19
20 >>> Ikiwiki does not hardcode http links anywhere. If you don't want
21 >>> it to use such links, change your configuration to use https
22 >>> consistently. --[[Joey]]
23
24 Errr... That is not a solution, that is a work around. ikiwiki does not hard
25 code the absolute paths, but absolute paths are hard coded in the configuration
26 file. If you want to serve your website so that the majority of users can see
27 it as http, including in rss feeds (this allows proxy caches to cache the
28 contents and has reduced load requirements), but editing is done via https for
29 increased security, it is not possible. I have some ideas how this can be
30 implemented (as ikiwiki has the absolute path to the CGI script and the
31 absolute path to the destination, it should be possible to generate a relative
32 path from one to the other), although some minor issues still need to be
33 resolved. -- Brian May
34
35 I noticed the links to the images on <http://ikiwiki.info/recentchanges/> are
36 also absolute, that is <http://ikiwiki.info/wikiicons/diff.png>; this seems
37 surprising, as the change.tmpl file uses &lt;TMPL_VAR BASEURL&gt; which seems
38 to do the right thing in page.tmpl, but not for change.tmpl. Where is BASEURL
39 set? -- Brian May
40
41 > The use of an absolute baseurl in change.tmpl is a special case. --[[Joey]]
42
43 So I'm facing this same issue. I have a wiki which needs to be accessed on
44 three different URLs(!) and the hard coding of the URL from the setup file is
45 becoming a problem for me. Is there anything I can do here? --[[Perry]]
46
47 > I remain puzzled by the problem that Brian is discussing. I don't see
48 > why you can't just set the cgiurl and url to a https url, and serve
49 > the site using both http and https.
50
51 > Just for example, <https://kitenet.net/> is an ikiwiki, and it is accessible
52 > via https or http, and if you use https, links will remain on https (except
53 > for links using the cgi, which I could fix by changing the cgiurl to https).
54
55 > I think it's possible ikiwiki used to have some
56 > absolute urls that have been fixed since Brian filed the bug. --[[Joey]]  
57
58 [[wishlist]]
59
60 ----
61
62 [[!template id=gitbranch branch=smcv/https author="[[smcv]]"]]
63 [[!tag patch]]
64
65 For a while I've been using a configuration where each wiki has a HTTP and
66 a HTTPS mirror, and updating one automatically updates the other, but
67 that seems unnecessarily complicated. My `https` branch adds `https_url`
68 and `https_cgiurl` config options which can be used to provide a HTTPS
69 variant of an existing site; the CGI script automatically detects whether
70 it was accessed over HTTPS and switches to the other one.
71
72 This required some refactoring, which might be worth merging even if
73 you don't like my approach:
74
75 * change `IkiWiki::cgiurl` to return the equivalent of `$config{cgiurl}` if
76   called with no parameters, and change all plugins to indirect through it
77   (then I only need to change that one function for the HTTPS hack)
78
79 * `IkiWiki::baseurl` already has similar behaviour, so change nearly all
80   references to the `$config{url}` to call `baseurl` (a couple of references
81   specifically wanted the top-level public URL for Google or Blogspam rather
82   than a URL for the user's browser, so I left those alone)
83
84 --[[smcv]]
85
86 > The justification for your patch seems to be wanting to use a different
87 > domain, like secure.foo.com, for https? Can you really not just configure
88 > both url and cgiurl to use `https://secure.foo.com/...` and rely on
89 > relative links to keep users of `http://insecure.foo.com/` on http until
90 > they need to use the cgi? 
91
92 >> My problem with that is that uses of the CGI aren't all equal (and that
93 >> the CA model is broken). You could put CGI uses in two classes:
94 >>
95 >> - websetup and other "serious" things (for the sites I'm running, which
96 >>   aren't very wiki-like, editing pages is also in this class).
97 >>   I'd like to be able to let privileged users log in over
98 >>   https with httpauth (or possibly even a client certificate), and I don't
99 >>   mind teaching these few people how to do the necessary contortions to
100 >>   enable something like CACert.
101 >>
102 >> - Random users making limited use of the CGI: do=goto, do=404, and
103 >>   commenting with an OpenID. I don't think it's realistic to expect
104 >>   users to jump through all the CA hoops to get CACert installed for that,
105 >>   which leaves their browsers being actively obstructive, unless I either
106 >>   pay the CA tax (per subdomain) to get "real" certificates, or use plain
107 >>   http.
108 >>
109 >> On a more wiki-like wiki, the second group would include normal page edits.
110 >>
111 >> Perhaps I'm doing this backwards, and instead of having the master
112 >> `url`/`cgiurl` be the HTTP version and providing tweakables to override
113 >> these with HTTPS, I should be overriding particular uses to plain HTTP...
114 >>
115 >> --[[smcv]]
116
117 > I'm unconvinced.
118
119 > `Ikiwiki::baseurl()."foo"` just seems to be asking for trouble,
120 > ie being accidentially written as `IkiWiki::baseurl("foo")`,
121 > which will fail when foo is not a page, but some file.
122
123 >> That's a good point. --s
124
125 > I see multiple places (inline.pm, meta.pm, poll.pm, recentchanges.pm)
126 > where it will now put the https url into a static page if the build
127 > happens to be done by the cgi accessed via https, but not otherwise.
128 > I would rather not have to audit for such problems going forward.
129
130 >> Yes, that's a problem with this approach (either way round). Perhaps
131 >> making it easier to run two mostly-synched copies like I was previously
132 >> doing is the only solution... --s