An idea to solve Chrome’s native Google Translate function: 1/3

Original link: https://dosk.win/2022/10/27/jie-jue-chrome-yuan-sheng-gu-ge-fan-yi-gong-nai-de-yi-ge-si-lu-1 -3/

The basic idea

  1. In essence, translate.google.com and translate.googleapis.com cannot be accessed (which domain names I have not looked at carefully), then we first solve the problem of unreachable access

  2. You can find a VPS that can be accessed as a reverse proxy. Some people say that I can’t apply for certificates for these two domain names, so we can do SNI proxy directly through HAProxy .

base code

 global log 127.0.0.1 local3 chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 4000 user haproxy group haproxy daemon defaults log global option dontlognull option http-server-close option redispatch retries 3 timeout http-request 10s timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout http-keep-alive 10s timeout check 10s maxconn 3000 frontend https_proxy mode tcp bind :443 tcp-request inspect-delay 5s tcp-request content accept if { req_ssl_hello_type 1 } acl is_google_translate req_ssl_sni -i translate.google.com use_backend google_translate if is_google_translate backend google_translate server web1 translate.google.com:443

How to eat

  1. Find a VPS to install HAProxy and configure the above logic (add other domain names as appropriate)

  2. The reason why the title of this article is written 1/3 is because after doing this, it is equivalent to physically adding a server to Google , but the domain name has not been resolved, and we have no way to affect everyone’s resolution, so it is temporarily modified here. /etc/hosts implementation, after all, various plug-ins cannot affect Chrome ‘s own parsing

  3. Modifying /etc/hosts is more troublesome after all, but now at least it ensures that we don’t need to update things even if the IP changes in the future

  4. Forewarning (dig a hole): I will find a way to limit this thing to the scope of Chrome applications later. At present, the way I think of is to write a plug-in, start an HTTPDNS service internally, and then set up in Chrome to use http://localhost for parsing, Maybe I can do other things easily. Of course, the old man who is not bad can buy a domestic VPS to do this, so that you don’t need to write plug-ins or anything. You can use emmm directly after setting it in Chrome

This article is reprinted from: https://dosk.win/2022/10/27/jie-jue-chrome-yuan-sheng-gu-ge-fan-yi-gong-nai-de-yi-ge-si-lu-1 -3/
This site is for inclusion only, and the copyright belongs to the original author.