index.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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="stylesheet" href="../style.css#" type="text/css" />
  7. <title>Hosts files</title>
  8. <script type="text/javascript">
  9. function findLang(){
  10. let href = location.href;
  11. for(let i=href.length-1;i>0;i--){
  12. if('/'==href.charAt(i) && '/'==href.charAt(i-3))
  13. return i;
  14. }
  15. return 0;
  16. }
  17. function nav2(page){
  18. let i = findLang();
  19. location.href = location.href.substring(0,i+1)+page;
  20. }
  21. function nav2Lang(lang){
  22. let i = findLang();
  23. let href = location.href;
  24. location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
  25. }
  26. </script>
  27. </head>
  28. <body>
  29. <header class='header'>
  30. <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>
  31. <a class="logo" href="javascript:void(0)" onclick="return nav2Lang('zh')">简体中文</a>
  32. <nav>
  33. </nav>
  34. </header>
  35. <br />
  36. <div class="container">
  37. <h1 class="title">Hosts files
  38. <br>
  39. <span class="subtitle"></span>
  40. </h1>
  41. <ul class="tags">
  42. <li><a href="../tags/adblock/index.html#">adblock</a> </li>
  43. </ul>
  44. <p>The enhanced hosts files &quot;hosts&quot; and &quot;default.hosts&quot; take effect with the setting option &quot;use hosts&quot;.</p>
  45. <h4 id="hosts">hosts</h4>
  46. <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>
  47. [[IP address][attributes]][single space][domain name]</p>
  48. <p>where &quot;[[IP address][attributes]]&quot; could be:</p>
  49. <ul>
  50. <li>
  51. <p>ipv4 address such as:<br>
  52. 172.67.157.211 torapp.eu.org</p>
  53. </li>
  54. <li>
  55. <p>ipv6 address, Ex.:<br>
  56. [2606:4700:3037::6815:8c3] torapp.eu.org</p>
  57. </li>
  58. <li>
  59. <p>empty, that would lift all server-imposed limitations. Ex.:<br>
  60. [single space]gitee.com</p>
  61. <p>which will make all git repositories on the domain visitable as websites with raw file access url.</p>
  62. </li>
  63. <li>
  64. <p>response headers, separeded by ';', Ex.:<br>
  65. Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true mybing.xn--xyza.top</p>
  66. <p>which makes &quot;mybing2.xn--xyza.top&quot; to accept CORS requests with cookies.</p>
  67. </li>
  68. <li>
  69. <p>IP address and response headers, separeded by ';', Ex.:<br>
  70. 104.21.8.195;Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true uweb.torapp.eu.org</p>
  71. </li>
  72. <li>
  73. <p>IP address, real domain name and response headers (Experimental), separeded by ';', Ex.:<br>
  74. 104.21.8.195;www.bing.com uweb.torapp.eu.org</p>
  75. <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>
  76. <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>
  77. </li>
  78. </ul>
  79. <h4 id="defaulthosts">default.hosts</h4>
  80. <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>
  81. <p>Each line of the hosts file has the following format:<br>
  82. [rootDomain][space][regex for domain prefix before rootDomain][space][regex for the whole url without &quot;http(s)://&quot;]<br>
  83. 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>
  84. </div>
  85. <p>Last Modified: 2 April 2024<br>
  86. update bingAI/js/optionsSets.js<br>
  87. <pre></pre>
  88. </p>
  89. <script id='jsgiscus'
  90. src='https://giscus.app/client.js'
  91. data-repo="torappinfo/uweb"
  92. data-repo-id="MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
  93. data-category="Announcements"
  94. data-category-id="DIC_kwDOEgNLGc4CQjsh"
  95. data-mapping="title"
  96. data-strict="0"
  97. data-reactions-enabled="1"
  98. data-emit-metadata="0"
  99. data-input-position="top"
  100. data-theme="light"
  101. data-lang="en"
  102. data-loading="lazy"
  103. crossorigin="anonymous" async>
  104. </script>
  105. <footer class="site-footer">
  106. <div class="container">
  107. &copy; 2018-2024 Richard H. Cao
  108. </div>
  109. </footer>
  110. <!-- 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/>. -->
  111. </body>
  112. </html>