简体   繁体   English

尝试将Nginx设置为Facebook的反向代理,但出现Facebook错误

[英]Trying to setup nginx as a reverse proxy for facebook, but getting facebook error

my fathers job requires him to use a VPN to access anything work related (emails, websites, etc) outside his office, and the VPN blocks facebook, currently whenever he wants to use facebook, he has to log off the VPN first. 我父亲的工作要求他使用VPN来访问办公室外与工作相关的任何内容(电子邮件,网站等),并且VPN阻止了facebook,目前,每当他要使用facebook时,都必须先注销VPN。 He asked me if I could set up something to try and get around that, so I am attempting to setup NGINX on Debian 9 to act as a reverse proxy, however I have very little experience with NGINX. 他问我是否可以设置一些方法来解决该问题,所以我试图在Debian 9上设置NGINX以充当反向代理,但是我对NGINX的经验很少。 I have found that if I include proxy_set_header Host $host; 我发现如果包含proxy_set_header Host $host; then I can get to facebook but see "Sorry, something went wrong. We're working on getting this fixed as soon as we can." 然后我可以去facebook,但是看到“对不起,出了点问题。我们正在努力尽快修复此问题。” But if I don't include it the VPN still blocks facebook. 但是,如果我不包括它,VPN仍然会阻止facebook。 Any advice? 有什么建议吗?

nginx config Nginx配置

You're not going to be able to reverse proxy Facebook, for a few reasons: 由于以下几个原因,您将无法反向代理Facebook:

  • facebook.com isn't going to load from an alternative hostname, such as kyles-facebook-proxy-clone.com . facebook.com不会从备用主机名(例如kyles-facebook-proxy-clone.com The browser sends a request header, Host . 浏览器发送请求标头Host Facebook's servers won't serve for a hostname that they aren't expecting. Facebook的服务器不会提供他们所期望的主机名。
  • Undoubtedly there's some client-side JavaScript that will be hardcoded to other hostnames you're not proxying (for API access, CDNs for images/video, etc.) that will break, unless you rewrote the page in your code as well (which isn't reasonably possible due to obfuscation). 毫无疑问,有一些客户端JavaScript将被硬编码为您未代理的其他主机名(用于API访问,用于图像/视频的CDN等),除非您也将页面重写为代码中的(不是)由于混淆而不太可能)。
  • You can't serve traffic for facebook.com without having a properly signed certificate for HTTPS. 没有HTTPS正确签名的证书,就无法为facebook.com提供流量。 HTTPS is required for facebook.com due to HSTS . 由于HSTSfacebook.com需要HTTPS。
  • Even if you managed to get a certificate, it isn't going to work due to key pinning . 即使您设法获得了证书,由于密钥固定 ,它也无法正常工作。

What can you do? 你能做什么?

  • Use a proper proxy server. 使用适当的代理服务器。
  • Use Tor . 使用Tor
  • Ask for Facebook to be let through on the VPN. 要求Facebook在VPN上通过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM