add uptodown link
[uweb.git] / en / adblock_domain / index.html
blob91c70928740110dd3ac5726d9ebd2759434ebda4
1 <!doctype html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1" />
6 <link rel="canonical" href="https://jamesfengcao.gitlab.io/uweb/en/adblock_domain/" />
8 <link rel="stylesheet" href="../style.css#" type="text/css" />
9 <title>Hosts files</title>
10 <script>
11 function findLang(){
12 let href = location.href;
13 for(let i=href.length-1;i>0;i--){
14 if('/'==href.charAt(i) && '/'==href.charAt(i-3))
15 return i;
17 return 0;
19 function nav2(page){
20 let i = findLang();
21 location.href = location.href.substring(0,i+1)+page;
23 function nav2Lang(lang){
24 let i = findLang();
25 let href = location.href;
26 location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
28 </script>
29 </head>
30 <body>
31 <header class='header'>
32 <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>
35 <a class="logo" href="javascript:void(0)" onclick="return nav2Lang('zh')">简体中文</a>
38 <nav>
39 </nav>
40 </header>
41 <br />
43 <div class="container">
44 <h1 class="title">Hosts files
45 <br>
46 <span class="subtitle"></span>
47 </h1>
48 <ul class="tags">
50 <li><a href="../tags/adblock/index.html#">adblock</a> </li>
52 </ul>
53 <p>The enhanced hosts files &quot;hosts&quot; and &quot;default.hosts&quot; take effect with the setting option &quot;use hosts&quot;.</p>
54 <h4 id="hosts">hosts</h4>
55 <p>The <span style="color:red">enhanced</span> file <a href="file:///data/data/info.torapp.uweb/files/hosts">&quot;hosts&quot;</a> defines IP addresses/attributes for domains. Each line has the following format:<br>
56 [[IP address][attributes]][single space][domain name]</p>
57 <p>where &quot;[[IP address][attributes]]&quot; could be:</p>
58 <ul>
59 <li>
60 <p>ipv4 address such as:<br>
61 172.67.157.211 torapp.eu.org</p>
62 </li>
63 <li>
64 <p>ipv6 address, Ex.:<br>
65 [2606:4700:3037::6815:8c3] torapp.eu.org</p>
66 </li>
67 <li>
68 <p>empty, that would lift all server-imposed limitations. Ex.:<br>
69 [single space]gitee.com</p>
70 <p>which will make all git repositories on the domain visitable as websites with raw file access url.</p>
71 </li>
72 <li>
73 <p>response headers, separeded by ';', Ex.:<br>
74 Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true mybing.xn--xyza.top</p>
75 <p>which makes &quot;mybing2.xn--xyza.top&quot; to accept CORS requests with cookies.</p>
76 </li>
77 <li>
78 <p>IP address and response headers, separeded by ';', Ex.:<br>
79 104.21.8.195;Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true uweb.torapp.eu.org</p>
80 </li>
81 <li>
82 <p>IP address, real domain name and response headers (Experimental), separeded by ';', Ex.:<br>
83 104.21.8.195;www.bing.com uweb.torapp.eu.org</p>
84 <p>which indicates the domain &quot;uweb.torapp.eu.org&quot; is just a proxy of &quot;www.bing.com&quot;, and as such, the cookies of &quot;www.bing.com&quot; would be used for &quot;uweb.torapp.eu.org&quot;.</p>
85 <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>
86 </li>
87 </ul>
88 <h4 id="defaulthosts">default.hosts</h4>
89 <p><a href="file:///data/data/info.torapp.uweb/files/default.hosts">&quot;default.hosts&quot;</a> blocks whole domain trees including all descendant domains. The domains in the hosts file must be 2 or 3 segment domains, such as &quot;yahoo.com&quot; and &quot;finance.yahoo.com&quot;. If the length of the last 2 segments is less than 7, such as &quot;com.pl&quot;, then it is treated as one segment, so domains like &quot;xxx.xxx.com.pl&quot; are also valid in the hosts file.</p>
90 <p>Each line of the hosts file has the following format:<br>
91 [rootDomain][space][regex for domain prefix before rootDomain][space][regex for the whole url without &quot;http(s)://&quot;]<br>
92 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 </div>
95 <p>Last Modified: 2 April 2024<br>
96 update bingAI/js/optionsSets.js<br>
97 <pre></pre>
98 </p>
100 <script id='jsgiscus'
101 src='https://giscus.app/client.js'
102 data-repo="torappinfo/uweb"
103 data-repo-id="MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
104 data-category="Announcements"
105 data-category-id="DIC_kwDOEgNLGc4CQjsh"
106 data-mapping="title"
107 data-strict="0"
108 data-reactions-enabled="1"
109 data-emit-metadata="0"
110 data-input-position="top"
111 data-theme="light"
112 data-lang="en"
113 data-loading="lazy"
114 crossorigin="anonymous" async>
115 </script>
117 <footer class="site-footer">
118 <div class="container">
119 &copy; 2018-2024 Richard H. Cao
120 </div>
121 </footer>
122 <!-- 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/>. -->
125 </body>
126 </html>