Skip to content
Александр Тауенис edited this page Apr 28, 2020 · 35 revisions

Settings of the program are stored in configuration file. By default it is the webone.conf file in current directory, but any other file may be used instead. To load an other configuration file launch the proxy server as dotnet WebOne.dll path\filename.ext.

Syntax

The configuration file format is similar to INI format, but with some differences. It can contain sections that are list-based with no parameter=value pairs and section names can contain masks. Masked sections are used to apply some rules to some URLs or to some content and their section headers are looking like this: [SectionType:Section mask] (e.g. [FixableURL:jquery.min.js]).

The values of parameters (or options) can be a text, numbers or Boolean values. Boolean (binary) parameters can be set to 1/0, y/n, yes/no, on/off, enable/disable or true/false.

Comments must begin with ";" and starts only from the start of the line. Extra spaces everywhere are not allowed. Parameters must be written as parameter=value, not as parameter = value (with spaces).

The file is case sensitive, so be aware on all parameter names and values.

If any parameter is not written in real configuration file or if the file cannot be loaded, default values are used. All lists are empty by default.

The article has been written for WebOne version 0.10.0.0.

[Server] options

The section configures common proxy server settings.

  • Port - TCP port where the server should be run. Default: 80. Port can be overrided by starting server as webone PORT or webone PORT CONFIGFILE.
  • OutputEncoding - encoding (code page) of output content. WebOne can convert text-based content from source encoding to any set in this parameter. This may allow browsing non-English sites on MS-DOS/Unix machines or via non-Unicode-aware browser. Here you may set any code page number, Windows (to auto-detect ANSI code page for server's locale), DOS (to auto-detect OEM code page), EBCDIC (to auto-detect IBM code page) or Mac (to auto-detect Apple code page for server's locale). Or to do not touch the code page set it to AsIs. Default: AsIs.
  • Authenticate - HTTP Proxy authentication credentials. If you want to start the WebOne on a publicly accessible host set this protection from unwanted users. Any open proxy can be used to do illegal things. WebOne uses simple basic authentication with login:password pair. Set them here to enable protection. Or do not set this parameter at all to make the server unprotected (for local networks). Кириллицу использовать нежелательно. Default: empty (no authentication).
  • HideClientErrors - hide any client's errors in WebOne log. If browser rejects packages from proxy (if user has clicked "Stop" button, closed the tab, the browser doesn't like format of the file, etc) WebOne begins to be sad. Because empty tears are not need to be logged, they may be ignored by this parameter. Default: no (errors will be shown).
  • SearchInArchive - allow searching of archived copies of unavailable content via Internet Archive Wayback Machine. Default: no.
  • ShortenArchiveErrors - because very old browser can't correctly display Archive.org error pages, WebOne can show internal error pages that are friendly to retro browsers. They can be enabled by this parameter. Default: no.
  • SecurityProtocols - possible workaround for SSL/TLS errors. It enables or disables particular security protocols. This setting is based on SecurityProtocolType Enum and can be either a single type or an OR-ed combination of them. Default: unset or 4032 (4032 = 192 | 768 | 3072) depending on OS version and MS IE settings.
  • ValidateCertificates - enable or disable TLS certificate validation. May be useful if the server have incorrect date and time or if you need to browse websites with incorrect certificates. Default: enable.
  • DefaultHostName - proxy host's name. It may be either %HostName% placeholder (default server PC name), a MS LAN Manager computer name, a IP address or a DNS name. By default WebOne is using local computer/host name for calling itself in network things, but UNIX/Linux/BSD clients don't understand Microsoft LAN Manager (Windows 7) computer names. Also if the server is working on Linux, any Windows PCs will not resolve it by its UNIX hostname. To solve such problems, enter here a address that can be used by clients to connect to the proxy server. Default: %HostName%.
  • UserAgent - user-agent string which servers will see on attempts to get something via this proxy. Default: %Original% WebOne/%WOVer%.

[ForceHttps] list

WebOne can automatically convert HTTP traffic to HTTPS. But some sites have incorrect redirection from old HTTP to new and secure HTTPS. The example is phantom.sannata.org where (on July, 2019) still used a Meta-Refresh tag to redirect clients which is not a good practice. Those sites (domain names) should be added to the ForceHttps list. It's some looking like HSTS list in modern browsers so it also can be used for security purposes.

Note that all sites with automatic HTTP->HTTPS security upgrades are adding to memory-stored version of this list until close of WebOne. So you don't need to add here all sites that are want to browse, except for security paranoia purposes.

[InternalRedirectOn] list

WebOne can use two ways of processing HTTP-302 redirections. By default since version 0.7.0 it returns the "error 302" with all need headers almost directly to the browser (with HTTPS-related stuff been cut), allowing it to process the redirect as it want. Older versions (0.6.x and earlier) on all 302 redirections processed them internally, and browser wasn't know that server returned the 302. As it turned out later, some sites are working better with the old algorithm of processing of 302s instead of the standard-compliant new. These sites can be added here for troubleshooting purposes. Please report to author of WebOne all sites that are need to be included in this list.

[ForceUtf8] list

If you're using code page conversion you might encounter lost of non-English characters on some sites or pages. This is caused by incorrect detection of source encoding, WebOne thinks that the page in encoded in Windows CP however it's really a UTF-8 page. Regular expression masks of URLs of such content can be added to this list to force downloading content as UTF-8 and solve conversion problems.

[TextTypes] list

WebOne applies edits only to text-based content, binary files are transferring as is. This section contains list of MIME types (or parts of types) that are corresponding to content which should be edited. By default it's "text/", "javascript" (means text/* and *javascript).

[Edit:] sections

Since version 0.10, all edits are stored in Sets of edits. They are replaced old FixableURL, FixableType and ContentPatch sections known from WebOne 0.3.x-0.9.x.

The Set can contain detection rules (determining when the Set should be used) and edition rules (what should be edited to make the web site usable in particular browser).

See full article about the Sets of edits.

[FixableURL:] sections

Obsolete since v0.10.0. Please use Sets of edits with AddRedirect edition rule. To replace some resources that are not need to be delivered to the "elderly" browser WebOne can make HTTP-302 redirections to other resources that are better in this case. Examples of such redirections are included in default webone.conf file.

The section header should contain regular expression mask for detection of "unwanted" URL. Be careful here and don't forget to add string begin and string end anchors.

  • ValidMask - to simplify RegExp masks after entering the section the URL checks again to contain second RegExp from this parameter. If the URL containing something from it, any processing stops and no redirections occur.
  • Redirect - the redirection destination address. May contain masks:
    • %URL% - original URL (non encoded).
    • %UrlNoQuery% - original URL without ?arguments=
    • %UrlHttps% - original URL with forced HTTPS protocol
    • %UrlHttp% - original URL with forced insecure HTTP protocol
    • %Url% - URL-encoded original URL (https://example.com -> https%3A%2F%2Fexample.com), don't confuse with %URL% which is not encoded.
    • %ProxyHost% - proxy host name. May be useful for using of in-proxy converters.
    • %ProxyPort% - proxy working port.
    • %Proxy% - shortcode for %ProxyHost%:%ProxyPort% which also may be equal to DefaultHostName setting.
  • Internal - the redirection can be hidden from browser. Enable internal redirectons to solve problems if any.

In included default webone.conf this section is used to downgrade JavaScript frameworks used on pages to older versions and to redirect some URLs to their archived copies.

[ContentPatch:] lists

Obsolete since v0.10.0. Please use Sets of edits with AddFind and AddReplace edit rules. Some text-based stuff in traffic can be edited like "Find and replace" feature of most popular text editors. This section is analog of that feature. It can edit (or "apply patches") anything in files of types listed in TextTypes list. This may be useful for patching modern JavaScript code for running in Netscape 3 or to fix Microsoft CDF files.

The section name containing Regular Expression mask and capture groups used to find blocks that should be edited.

  • Replace - replacement mask. Use multiple RegExp capture groups to make complex content patches.
  • IfURL - apply the patch only to content with specified URL (RegExp mask). Default: .* (all pages)
  • IfType - apply the patch only to content with specified MIME content type (RegExp mask). Default: .* (all text types)

Tip: Use RegExp debuggers to create excellent masks and shorten time of Content Patch developing. I'm recommending RegExr (Flash) and Regular Expressions 101.

[FixableType:] lists

Obsolete since v0.10.0. Please use Sets of edits with OnContentType detection rule and AddRedirect edit rule or Sets of edits with OnContentType detection rule and AddConvert edit rules. The second way (seamless mode) is better. The first is a equivalent to [FixableType:], but have may cause some problems with CAPTCHAs and some servers.

List of online file format converters that can be used with WebOne. They may be used, for example, to convert WebP graphics to GIF. The proxy server will redirect client on any attempt to download a file with MIME type from name of the section.

  • IfUrl - RegExp mask of URLs where the rule should be used.
  • NotUrl - RegExp mask of URLs wherу the rule should not be used.
  • Redirect - URL of a online converter which should make the conversion. May contain masks:
    • %URL% - original URL (non encoded).
    • %UrlNoQuery% - original URL without ?arguments=
    • %UrlHttps% - original URL with forced HTTPS protocol
    • %UrlHttp% - original URL with forced insecure HTTP protocol
    • %Url% - URL-encoded original URL (https://example.com -> https%3A%2F%2Fexample.com), don't confuse with %URL% which is not encoded.
    • %ProxyHost% - proxy host name. May be useful for using of in-proxy converters.
    • %ProxyPort% - proxy working port.
    • %Proxy% - shortcode for %ProxyHost%:%ProxyPort% which also may be equal to DefaultHostName setting.

[Converters] list

White list of file format converters that can be used inside WebOne as a equivalent to online converter(s). The converters are local executable files (on Windows - EXE, COM, BAT, CMD and such) that can get 2-4 arguments. Converter entry should contain converter executable file name and masks for all arguments (see below). The default converter is ImageMagick's convert, running as convert %SRC% %ARG1% %DEST% %ARG2% (convert.exe SOURCE.EXT -ARGUMENT1 VALUE1 DESTINATION.EXT -ARGUMENT2 VALUE2).

The converter entry can contain following masks:

  • %SRC% - source file name
  • %ARG1% - first argument(s)
  • %DEST% - destination file name
  • or %DESTEXT% - destination file extension
  • %ARG2% - second argument(s)
  • %SRCURL% - source file's URL

If the converter does not know argument by %DEST% mask, WebOne thinks that it gives result to STDOUT. E.g. ImageMagick can return source.ext picture converted to GIF format through STDOUT when called as magick source.ext gif:-. This is faster that traditional temporary file for conversion result, especially on large files and for video streams. Similar is for %SRC% mask, skipping of it meaning that the converter want to get input data via STDIN stream.

If the converter have %SRCURL% mask instead of %SRC% WebOne will not download the source file, thinking that the converter will download itself. It is useful in some cases like using of Youtube-dl.

All in-proxy converters can be accessed via special Edit rules (AddConvert+AddConvertDest+AddConvertArg1+etc) or through URLs (they was used in [FixableType] sections before introduction of Sets of edits):

  • http://proxyhost/!convert/?url=source url&dest=destination extension&type=destination mime type&util=converter.exe
  • or http://proxyhost/!convert/?url=source url&dest=destination extension&type=destination mime type
  • or http://proxyhost/!convert/?src=source local file&dest=...
  • or ...&arg=-ARGUMENT1%20VALUE1&arg2=-ARGUMENT2%20VALUE2

By default the dest="xbm", type="image/xbitmap" and util="convert". This meaning that a short call like http://proxyhost/!convert/?url=source url will produce a X Bitmap file by ImageMagick.

Because any converter is an application, to be used in WebOne it must be listed in the [Converters] list for security purposes. Unlisted (disallowed) applications will not run at all.

[Translit] section

Some browsers cannot display anything other than English letters (Code Page 437 or something). To add ability to display non-English content in such browsers, WebOne can change (transliterate) non-English letters to their equivalents from Latin alphabet. E.g. Cyrillic "Д" to Latin "D" or Greek "Σ" to Latin "S".

To enable transliteration, add a [Translit] section to configuration file. It should contain original letter on left, then a "=" character, and then the latin letter (or letters) on the right. E.g. "Д=D". Note that the section is case sensitive, so д/Д and d/D are different letters.

To solve problems with encodings, the configuration file should be saved in UTF-8 encoding and have OutputEncoding option set to anything other than AsIs.


See comments in default configuration file for notes about bugs in the current version and recent changes.