Dear ikiwiki folks,
using Debian Wheezy and ikiwiki 3.20120629 for some reason when accessing the site using HTTP (and not HTTPS), going to Edit, so executing the CGI script, all URLs are prepended with HTTPS, which I do not want.
    <base href="https://www.example.org/" />
Trying to look at the source, I guess it is originating from IkiWiki/CGI.pm.
    sub printheader ($) {
        my $session=shift;
        if (($ENV{HTTPS} && lc $ENV{HTTPS} ne "off") || $config{sslcookie}) {
            print $session->header(-charset => 'utf-8',
                -cookie => $session->cookie(-httponly => 1, -secure => 1));
        }
        else {
            print $session->header(-charset => 'utf-8',
                -cookie => $session->cookie(-httponly => 1));
        }
    }
Does it check if HTTPS is enabled in the environment? During ikiwiki --setup example.setup or when the CGI script is run when the site is accessed (for example in an Apache environment)?
Can this somehow be disabled in ikiwiki. Reading the code I guess I could somehow set HTTPS = off somewhere in the VirtualHost section of the Apache configuration.
Thanks,
--?PaulePanter
IkiWiki generates self-referential URLs using the
urlandcgiurlconfiguration parameters, and theurlto()andcgiurl()functions; the code you quoted isn't involved (it's choosing whether to set HTTPS-only cookies or not, rather than choosing how to generate self-referential URLs).If you want your wiki to be accessible via both HTTP and HTTPS, and use whichever the user first requested, you should set both
urlandcgiurlto the same URI scheme and hostname with no port specified, either bothhttpor bothhttps, for instance:or
(or the Perl-syntax equivalents if you're not using a YAML setup file).
If you use one of those, IkiWiki will attempt to generate path-only links, like "/wiki/" and "/cgi-bin/ikiwiki?...", whenever it's valid to do so. A visitor using HTTP will stay on HTTP and a visitor using HTTPS will stay on HTTPS.
The choice of
httporhttpsfor theurlandcgiurlstill matters when a URL must be absolute, such as in an RSS feed.I improved this code in late 2010 for this todo item: want to avoid ikiwiki using http or https in urls to allow serving both. It's possible that it has regressed (that's happened a couple of times). If it has, please quote your exact
urlandcgiurlconfiguration.In git master, if
$config{html5} = 1then the<base>URL will usually be host-relative or protocol-relative (/wiki/or//example.com/wiki/) which reduces the need for that option.This is not yet available in a release, and is still subject to change.
I still don't know what your wiki's configuration is, because you never told us the settings I asked for (
cgiurlandurl), so I don't know whether this will help you.