response
[ikiwiki] / doc / bugs / preview_base_url_should_be_absolute.mdwn
1 The edit page CGI defines a `base` tag with an URL which is not
2 absolute, which can break the preview function in some circumstances
3 (with e.g. images not showing). The trivial [[patch]] that fixes
4 it can be found [[here|http://sprunge.us/EPHT]] as well as on [[my
5 git|http://git.oblomov.eu/ikiwiki]].
6
7 > That patch does mean that if you're accessing the CGI via HTTPS but your
8 > $config{url} and $config{cgiurl} are HTTP, you'll get preview images loaded
9 > via HTTP, causing the browser to complain. See
10 > [[todo/want_to_avoid_ikiwiki_using_http_or_https_in_urls_to_allow_serving_both]]
11 > for background.
12 >
13 > Perhaps the CGI could form its `<base>` URL by using
14 > `URI->new_abs(urlto(...), $cgi->url)` instead?
15 >
16 > You'd also need to change `IkiWiki/Wrapper.pm` to pass at least the
17 > SERVER_NAME and SERVER_PORT through the environment, probably.
18 >
19 > Joey's last comment on
20 > [[todo/want_to_avoid_ikiwiki_using_http_or_https_in_urls_to_allow_serving_both]]
21 > suggests that this might already work, but I'm not quite sure how - I'd
22 > expect it to need more environment variables? --[[smcv]]
23 >
24 >> `CGI::url` uses `REQUEST_URI`. So it could be used, but I don't see
25 >> how to get from the `CGI::url` to an url to the page that is being
26 >> edited. --[[Joey]]