url_rewrite_program directive has vague documentation. It says that the program in question should accept a “format” described as:
[channel-ID <SP>] URL [<SP> extras]<NL>
This string can be interpreted in two ways:
- channel-id and the following
<SP>will be surrounded by square brackets, along with the extras string afterwards.
- channel-id and extras are OPTIONAL. Sometimes they will be provided, sometimes not.
I suspect (but can’t be sure) that #2 is the correct interpretation, since there’s a note
telling me to look someplace else to learn how to ‘send “extras” with
optional values to the helper.’ I don’t much care about the extras. All I really need is the URL.
There’s no documentation describing how to control whether the optional fields are sent, and this is bad, because the only required field is in the middle. You can only discern which field is which by trying to parse them as channels, URLs, and “extras”.
But the format of a “channel” and an “extra” is also not described in the documentation to url_rewrite_program, and I’ll sooner read the source code than go through the documentation for all the other, irrelevant options. Maybe it’d be faster to write an HTTP proxy from scratch than to try to understand enough of the configuration file to make this one option work.
It’s apparently really important to recognize when a channel-ID has been provided, since it’s required that this string be echoed back for all requests that have one.
Could somebody clarify for me how a url_rewrite_program is supposed to work?