The enhanced hosts files "hosts" and "default.hosts" take effect with the setting option "use hosts".
The enhanced file "hosts" defines IP addresses/attributes for domains. Each line has the following format:
[[IP address][attributes]][single space][domain name]
where "[[IP address][attributes]]" could be:
ipv4 address such as:
172.67.157.211 torapp.eu.org
ipv6 address, Ex.:
[2606:4700:3037::6815:8c3] torapp.eu.org
empty, that would lift all server-imposed limitations. Ex.:
[single space]gitee.com
which will make all git repositories on the domain visitable as websites with raw file access url.
response headers, separeded by ';', Ex.:
Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true mybing.xn--xyza.top
which makes "mybing2.xn--xyza.top" to accept CORS requests with cookies.
IP address and response headers, separeded by ';', Ex.:
104.21.8.195;Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true uweb.torapp.eu.org
IP address, real domain name and response headers (Experimental), separeded by ';', Ex.:
104.21.8.195;www.bing.com uweb.torapp.eu.org
which indicates the domain "uweb.torapp.eu.org" is just a proxy of "www.bing.com", and as such, the cookies of "www.bing.com" would be used for "uweb.torapp.eu.org".
To make life easier, use lower-case domain name (the first letter should not be a digital) and capitalize the first letter of response header names.
"default.hosts" blocks whole domain trees including all descendant domains. The domains in the hosts file must be 2 or 3 segment domains, such as "yahoo.com" and "finance.yahoo.com". If the length of the last 2 segments is less than 7, such as "com.pl", then it is treated as one segment, so domains like "xxx.xxx.com.pl" are also valid in the hosts file.
Each line of the hosts file has the following format:
[rootDomain][space][regex for domain prefix before rootDomain][space][regex for the whole url without "http(s)://"]
The first part [rootDomain] is required and the others are optional. regex is java-grammar regular expression. If the second regex is used, it is recommended to merge the first regex to the second one for performance.
Last Modified: 13 May 2023
refine global redirection cookie support