简体   繁体   English

在jquery.load中调用外部网站URL

[英]To call external website url in jquery.load

I'm using two servers one is Tomcat and other Node.js. 我正在使用两台服务器,一台是Tomcat,另一台是Node.js。

Now I want to call node.js application form Tomcat application,For that I tried like following: 现在我想从Tomcat应用程序调用node.js应用程序,为此,我尝试如下操作:

         $("#chatArea").load("http://localhost:3000/?id=man&to=opp");

But it doesn't worked,after goggling I found following: 但这不起作用,经过一番摸索,我发现以下内容:

     $("#chatArea").html('<object data="http://vvvurt.org:3000/?id=man&to=opp" />');

           //calling node.js application from tomcat.

It Worked But problem here is SECURITY,By clicking on Inspect element Any user can see the url http://vvvurt.org:3000/?id=man&to=opp and can pass any parameters to node.js application. 它起作用了,但是这里的问题是安全性,通过单击Inspect元素,任何用户都可以看到URL http://vvvurt.org:3000/?id=man&to=opp并将任何参数传递给node.js应用程序。

Not only in this situation I faced it so many times. 不仅在这种情况下,我面对了很多次。
How can I stop this kind of bug. 我该如何阻止这种错误。

Security isn't a bug. 安全性不是错误。 What I do when I need to locally communicate between two local servers is disable web security in Chrome Canary, to ensure I'm not using proper Chrome and open up to vulnerabilities. 当我需要在两台本地服务器之间进行本地通信时,我要做的就是禁用Chrome Canary中的网络安全性,以确保我没有使用适当的Chrome并暴露出漏洞。 If you're on a Mac you can run this line on Terminal: 如果您使用的是Mac,则可以在终端上运行以下行:

open -a Google\ Chrome --args --disable-web-security

Write your application so that anything the client does can be publicly known, then handle authentication and authorization on the server side, so that whenever a call comes in to either of your two servers, you check to make sure that user really has the right to do it. 编写您的应用程序,以便可以公开了解客户端所做的所有事情,然后在服务器端处理身份验证和授权,以便每当对两个服务器中的任何一个进行呼叫时,您都要检查并确保该用户确实有权做吧。

Trust me, there are many other ways to see how and what your client is communicating to your servers, so you have to design you application while keeping in mind that anyone can see and understand how your client works. 相信我,还有许多其他方式可以查看客户端与服务器进行通信的方式和方式,因此您必须在设计应用程序的同时牢记任何人都可以看到并理解客户端的工作方式。

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

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