5 <meta name=
"viewport" content=
"width=device-width, initial-scale=1" />
7 <link rel=
"stylesheet" href=
"../style.css#" type=
"text/css" />
8 <title>Hosts files
</title>
9 <script type=
"text/javascript">
11 let href
= location
.href
;
12 for(let i
=href
.length
-1;i
>0;i
--){
13 if('/'==href
.charAt(i
) && '/'==href
.charAt(i
-3))
20 location
.href
= location
.href
.substring(0,i
+1)+page
;
22 function nav2Lang(lang
){
24 let href
= location
.href
;
25 location
.href
= location
.href
.substring(0,i
-2)+lang
+location
.href
.substring(i
);
30 <header class='header'
>
31 <a class=
"logo" href=
"javascript:void(0)" onclick=
"return nav2('index.html#')">Home
</a> <a class=
"logo" href=
"javascript:void(0)" onclick=
"return nav2('tags/index.html#')">Tags
</a>
34 <a class=
"logo" href=
"javascript:void(0)" onclick=
"return nav2Lang('zh')">简体中文
</a>
42 <div class=
"container">
43 <h1 class=
"title">Hosts files
45 <span class=
"subtitle"></span>
49 <li><a href=
"../tags/adblock/index.html#">adblock
</a> </li>
52 <p>The enhanced hosts files
"hosts
" and
"default.hosts
" take effect with the setting option
"use hosts
".
</p>
53 <h4 id=
"hosts">hosts
</h4>
54 <p>The
<span style=
"color:red">enhanced
</span> file
<a href=
"file:///data/data/info.torapp.uweb/files/hosts">"hosts
"</a> defines IP addresses/attributes for domains. Each line has the following format:
<br>
55 [[IP address][attributes]][single space][domain name]
</p>
56 <p>where
"[[IP address][attributes]]
" could be:
</p>
59 <p>ipv4 address such as:
<br>
60 172.67.157.211 torapp.eu.org
</p>
63 <p>ipv6 address, Ex.:
<br>
64 [
2606:
4700:
3037::
6815:
8c3] torapp.eu.org
</p>
67 <p>empty, that would lift all server-imposed limitations. Ex.:
<br>
68 [single space]gitee.com
</p>
69 <p>which will make all git repositories on the domain visitable as websites with raw file access url.
</p>
72 <p>response headers, separeded by ';', Ex.:
<br>
73 Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true mybing.xn--xyza.top
</p>
74 <p>which makes
"mybing2.xn--xyza.top
" to accept CORS requests with cookies.
</p>
77 <p>IP address and response headers, separeded by ';', Ex.:
<br>
78 104.21.8.195;Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true uweb.torapp.eu.org
</p>
81 <p>IP address, real domain name and response headers (Experimental), separeded by ';', Ex.:
<br>
82 104.21.8.195;www.bing.com uweb.torapp.eu.org
</p>
83 <p>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
".
</p>
84 <p>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.
</p>
87 <h4 id=
"defaulthosts">default.hosts
</h4>
88 <p><a href=
"file:///data/data/info.torapp.uweb/files/default.hosts">"default.hosts
"</a> 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.
</p>
89 <p>Each line of the hosts file has the following format:
<br>
90 [rootDomain][space][regex for domain prefix before rootDomain][space][regex for the whole url without
"http(s)://
"]
<br>
91 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.
</p>
94 <p>Last Modified:
2 April
2024<br>
95 update bingAI/js/optionsSets.js
<br>
100 src='https://giscus.app/client.js'
101 data-repo=
"torappinfo/uweb"
102 data-repo-id=
"MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
103 data-category=
"Announcements"
104 data-category-id=
"DIC_kwDOEgNLGc4CQjsh"
107 data-reactions-enabled=
"1"
108 data-emit-metadata=
"0"
109 data-input-position=
"top"
113 crossorigin=
"anonymous" async
>
116 <footer class=
"site-footer">
117 <div class=
"container">
118 © 2018-
2024 Richard H. Cao
121 <!-- This document is licensed under the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at <https://www.gnu.org/licenses/>. -->