最近要在IDE或者浏览器插件中使用到Google翻译,但是国内又不大方便,某大佬提供了一个反代配置

11次阅读
没有评论

共计 586 个字符,预计需要花费 2 分钟才能阅读完成。

需要一个服务器,然后新建一个站点,然后用NGINX进行配置,其中反代配置如下


location / {
        proxy_pass https://translate.googleapis.com/; 
        proxy_redirect https://translate.googleapis.com/ /; 
        proxy_cookie_domain translate.googleapis.com [你的域名]; 
        proxy_set_header User-Agent $http_user_agent; 
        proxy_set_header Accept-Encoding ""; 
        sub_filter_once off; 
        add_header Cache-Control no-cache; 
        sub_filter "http://translate.googleapis.com" "http://[你的域名]"; 
        sub_filter "https://translate.googleapis.com" "https://[你的域名]"; 
        add_header Strict-Transport-Security "max-age=31536000"; 
        proxy_set_header Accept-Language "zh-CN"; 
    }

上面只是反代部分的配置,其他的按照NGINX的默认配置即可,配置完成后放到插件里面测试,我以ide插件示范

最近要在IDE或者浏览器插件中使用到Google翻译,但是国内又不大方便,某大佬提供了一个反代配置

最近要在IDE或者浏览器插件中使用到Google翻译,但是国内又不大方便,某大佬提供了一个反代配置

正文完
 0
Eric chan
版权声明:本站原创文章,由 Eric chan 于2025-04-27发表,共计586字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。