| 1 |
[[!comment format=mdwn |
| 2 |
username="http://smcv.pseudorandom.co.uk/" |
| 3 |
nickname="smcv" |
| 4 |
subject="comment 1" |
| 5 |
date="2012-11-05T11:27:02Z" |
| 6 |
content=""" |
| 7 |
IkiWiki generates self-referential URLs using the `url` and `cgiurl` |
| 8 |
configuration parameters, and the `urlto()` and `cgiurl()` functions; |
| 9 |
the code you quoted isn't involved (it's choosing whether to set |
| 10 |
HTTPS-only cookies or not, rather than choosing how to generate |
| 11 |
self-referential URLs). |
| 12 |
|
| 13 |
If you want your wiki to be accessible via both HTTP and HTTPS, and use |
| 14 |
whichever the user first requested, you should set both `url` and |
| 15 |
`cgiurl` to the same URI scheme and hostname with no port specified, |
| 16 |
either both `http` or both `https`, for instance: |
| 17 |
|
| 18 |
url: http://www.example.com/ |
| 19 |
cgiurl: http://www.example.com/ikiwiki.cgi |
| 20 |
|
| 21 |
or |
| 22 |
|
| 23 |
url: https://example.org/wiki/ |
| 24 |
cgiurl: https://example.org/cgi-bin/ikiwiki |
| 25 |
|
| 26 |
(or the Perl-syntax equivalents if you're not using a YAML |
| 27 |
setup file). |
| 28 |
|
| 29 |
If you use one of those, IkiWiki will attempt to generate |
| 30 |
path-only links, like \"/wiki/\" and \"/cgi-bin/ikiwiki?...\", |
| 31 |
whenever it's valid to do so. A visitor using HTTP will stay |
| 32 |
on HTTP and a visitor using HTTPS will stay on HTTPS. |
| 33 |
|
| 34 |
The choice of `http` or `https` for the `url` and `cgiurl` |
| 35 |
still matters when a URL *must* be absolute, such as in an |
| 36 |
RSS feed. |
| 37 |
|
| 38 |
I improved this code in late 2010 for this todo item: |
| 39 |
[[todo/want_to_avoid_ikiwiki_using_http_or_https_in_urls_to_allow_serving_both]]. |
| 40 |
It's possible that it has regressed (that's happened |
| 41 |
a couple of times). If it has, please quote your exact |
| 42 |
`url` and `cgiurl` configuration. |
| 43 |
"""]] |