The current development needs to call third-party interface of the project, the ajax post calls cross domain problems, but the other party is not willing to do the corresponding configuration solution on the server side, that I how to solve?
CodePudding user response:
Seems to have only each other configuration, erection may submit data, literally cross-domain site invasion is not easy
CodePudding user response:
You can call them on the server interface,
CodePudding user response:
Yes, cross-domain just modern standard HTML browser, your front access to your own server, then your servers "ask and answer" link, there is no cross domain,
CodePudding user response:
Say understand a little, want to know what is "cross domain" your application system, running on your client browser, appear at this time, that is actually the user terminal is basic mechanism of limit cross domain, the other server side just didn't cooperate to output a sign (configuration a "casual a string"), that is to say the other server-side personnel can be thought of as they don't support, it is conceivable, namely each other server personnel access to too little, too little experience, but does not affect their narrow think cross domain, and it is not any technology,
CodePudding user response:
refer to the second floor closure guest response: you can call them on the server interface, I back-end language is to use c #, excuse me, can write a c # example reference this to me? CodePudding user response:
reference 3 floor interacting in a professional developer response: yes, cross-domain just modern standard HTML browser, your front access to your own server, then your servers "ask and answer" link, there is no cross-domain, I back-end language is to use c #, excuse me, can write a c # example reference this to me? CodePudding user response:
refer to 6th floor paswar response: Quote: refer to the third floor interacting in a professional developer response: Yes, cross-domain just modern standard HTML browser, your front access to your own server, then your servers "ask and answer" link, there is no cross-domain, I back-end language is to use c #, excuse me, can write a c # example reference this to me? Such as your server to write a general call, such as var web=new WebClient (); Var result=web. UploadData (url, Encoding UTF8. GetBytes (body)); Var resultStr=Encoding. UTF8. Get string (result); the url is the target service address, the body is the post you want to submit the data, so it can get returns the string, and your own web services to make the front page access, web site encapsulates the url and the data from the request content, put resultStr encapsulation (or parsing, encapsulation) after return to their front, If your server is there something in particular "addiction", you can add some message control information, such as var web=new WebClient (); Web. Headers. Set (HttpRequestHeader. Cookies, cookies); If (referer==null) Referer="HTTP://http://10.134.111.111:8000/business/Edit.do? BizType=NEW "; Web. Headers. Set (HttpRequestHeader Referer, Referer); Web. Headers. Set (HttpRequestHeader. The Host, "10.134.111.111:8000"); Web. Headers. Set (HttpRequestHeader. Accept, "*/*"); Web. Headers. Set (HttpRequestHeader AcceptLanguage, "useful - CN"); Web. Headers. Set (" x - requested - with ", "XMLHttpRequest"); Web. Headers. Set (HttpRequestHeader ContentType, "application/x - WWW - form - urlencoded; charset=UTF-8"); Web. Headers. Set (HttpRequestHeader. The Host, "10.134.111.111:8000"); Web. Headers. Set (HttpRequestHeader UserAgent, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64. Trident/4.0; SLCC2; The.net CLR 2.0.50727; The.net CLR 3.5.30729; The.net CLR 3.0.30729; . NET4.0 C; NET4.0 E) "); Var result=web. UploadData (url, Encoding UTF8. GetBytes (body)); Var resultStr=Encoding. UTF8. Get string (result); it will be your server as a middle office system, CodePudding user response:
The other party is not willing to change the server, each other to solve is actually a word, add a header to allow. Anyway don't like, can add a proxy server, the client request it, acting on the server to request each other. But that is unnecessary trouble. The best solution or change each other, this makes sense. Interface of the service, if they do they don't solve this small problem, that's how to provide service interface, the giant public API service, at the time of call can also have this question? CodePudding user response:
Nginx can solve CodePudding user response:
Each other without solution you have 3 solutions. First, the front desk to use routing, vue such things as what fill inside.. After such as/API, you can access other site configuration it. Looks like a site you there would be no problem in ajax. Second, your ajax your own server, and then through the server-side code to request the other side of the interface, your server as a transit (the more common). A third, the back-end using ng, set up the path, let ng points to another site, root pointing to your site.. It is the same with the first such visit by. CodePudding user response:
It is better to consult with the third party CodePudding user response:
In short, you this belongs to the server cross-domain Understand the reverse proxy, cross-domain resources sharing