我怎样才能得到nginx反向代理与java小程序,检查文件库?

所以我试图用nginx设置一个反向代理到远程服务器上的Java applet,但是我遇到的问题是它检查文档库,我可以从http://remote.example.com/加载它http://remote.example.com/就好了,但是当我试图让它通过使用我试图使用的实际域的nginx运行, http://newdomain.example.com ,它会引发错误,因为文档库不是远程的。

有没有办法,我可以修改反向代理configuration传递http://remote.example.com/而不是http://newdomain.example.com/

这是我的configuration到目前为止

 upstream test { server remote.example.com:80; } server { listen *:80; server_name http://newdomain.example.com; location / { proxy_pass http://test; proxy_pass_request_headers on; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 180; proxy_send_timeout 180; proxy_read_timeout 180; } 

Host头改变

 proxy_set_header Host $http_host; 

 proxy_set_header Host remote.example.com; 

看起来我错误地解释了关于文档库的句子。 我认为这是从Java小程序服务器的保护,所以它不能被下载,除非我们改变Host头。 显然,你所说的文档库是java getDocumentBase函数。 由于Java applet是由浏览器执行的,所以在服务器端我们无能为力。