aboutsummaryrefslogtreecommitdiff
path: root/doc/todo/outbound_proxy.mdwn
blob: 2af0ae5ca6c51eda366a0357919ccf0df5e2f347 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
[[!template id=gitbranch branch=schmonz/proxy author="[[schmonz]]"]]
[[!tag patch]]

## Background

Ikiwiki has several plugins that open outbound connections:

* [[plugins/aggregate]]
* [[plugins/openid]]
* [[plugins/pinger]]

In some networks it is desired (or necessary) for these connections
to traverse a proxy. Proxies are usually configured via environment
variables, so for ikiwiki it is probably not desirable (or necessary)
to manage proxy configuration via new purpose-specific settings in
the setup file; `ENV` ought to suffice.

[[!cpan LWP::UserAgent]] by default doesn't care about the usual
environment variables, but if its constructor is passed a true
`env_proxy` value, it does. Then environment settings such as these
influence the agent, as expected:

    ENV:
      http_proxy: 'http://foo.internal:8080'
      no_proxy: 'localhost,.bar.internal'

If the proxy and/or destination requires authentication, it may
also be necessary to prime `cookiejar`.

## Changes

This patch causes ikiwiki's `LWP::UserAgent` instances to:

* honor proxy configuration in the environment
* consistently make use of cookies configured in the setup file

## Limitations

The patch lets me configure [[plugins/aggregate]] to traverse my
corporate proxy and to skip the proxy for internal hosts. I haven't
tested it with the other two plugins, both of which prefer [[!cpan
LWPx::ParanoidAgent]] if present, which deliberately lacks proxy
support. There exists [[!cpan LWP::UserAgent::Paranoid]] claiming
to be more modern, but I haven't looked at it further, so I don't
know whether its paranoia measures up or whether it supports proxies.

## See also

* [[bugs/http_proxy_for_openid]]
* [[forum/Setting_http__95__proxy]]

> This looks fine, but you forgot to move the config entry for cookiejar
> from aggregate to the config setting list in IkiWiki.pm --[[Joey]] 

>> Indeed, fixed. --[[schmonz]]

>>> [[merged|done]] --[[Joey]]