123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1" />
-
- <link rel="stylesheet" href="../style.css#" type="text/css" />
- <title>Hosts files</title>
- <script type="text/javascript">
- function findLang(){
- let href = location.href;
- for(let i=href.length-1;i>0;i--){
- if('/'==href.charAt(i) && '/'==href.charAt(i-3))
- return i;
- }
- return 0;
- }
- function nav2(page){
- let i = findLang();
- location.href = location.href.substring(0,i+1)+page;
- }
- function nav2Lang(lang){
- let i = findLang();
- let href = location.href;
- location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
- }
- </script>
- </head>
- <body>
- <header class='header'>
- <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>
-
-
- <a class="logo" href="javascript:void(0)" onclick="return nav2Lang('zh')">简体中文</a>
-
-
- <nav>
- </nav>
- </header>
- <br />
-
- <div class="container">
- <h1 class="title">Hosts files
- <br>
- <span class="subtitle"></span>
- </h1>
- <ul class="tags">
-
- <li><a href="../tags/adblock/index.html#">adblock</a> </li>
-
- </ul>
- <p>The enhanced hosts files "hosts" and "default.hosts" take effect with the setting option "use hosts".</p>
- <h4 id="hosts">hosts</h4>
- <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>
- [[IP address][attributes]][single space][domain name]</p>
- <p>where "[[IP address][attributes]]" could be:</p>
- <ul>
- <li>
- <p>ipv4 address such as:<br>
- 172.67.157.211 torapp.eu.org</p>
- </li>
- <li>
- <p>ipv6 address, Ex.:<br>
- [2606:4700:3037::6815:8c3] torapp.eu.org</p>
- </li>
- <li>
- <p>empty, that would lift all server-imposed limitations. Ex.:<br>
- [single space]gitee.com</p>
- <p>which will make all git repositories on the domain visitable as websites with raw file access url.</p>
- </li>
- <li>
- <p>response headers, separeded by ';', Ex.:<br>
- Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true mybing.xn--xyza.top</p>
- <p>which makes "mybing2.xn--xyza.top" to accept CORS requests with cookies.</p>
- </li>
- <li>
- <p>IP address and response headers, separeded by ';', Ex.:<br>
- 104.21.8.195;Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true uweb.torapp.eu.org</p>
- </li>
- <li>
- <p>IP address, real domain name and response headers (Experimental), separeded by ';', Ex.:<br>
- 104.21.8.195;www.bing.com uweb.torapp.eu.org</p>
- <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>
- <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>
- </li>
- </ul>
- <h4 id="defaulthosts">default.hosts</h4>
- <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>
- <p>Each line of the hosts file has the following format:<br>
- [rootDomain][space][regex for domain prefix before rootDomain][space][regex for the whole url without "http(s)://"]<br>
- 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>
- </div>
- <p>Last Modified: 2 April 2024<br>
- update bingAI/js/optionsSets.js<br>
- <pre></pre>
- </p>
- <script id='jsgiscus'
- src='https://giscus.app/client.js'
- data-repo="torappinfo/uweb"
- data-repo-id="MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
- data-category="Announcements"
- data-category-id="DIC_kwDOEgNLGc4CQjsh"
- data-mapping="title"
- data-strict="0"
- data-reactions-enabled="1"
- data-emit-metadata="0"
- data-input-position="top"
- data-theme="light"
- data-lang="en"
- data-loading="lazy"
- crossorigin="anonymous" async>
- </script>
- <footer class="site-footer">
- <div class="container">
- © 2018-2024 Richard H. Cao
- </div>
- </footer>
- <!-- 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/>. -->
- </body>
- </html>
|