What is across the field

The same origin policy caused by the browser interface call problem, and then the popular point is that Baidu domain name can not access sina interface.

How is cross-domain resolved

jsonp

Since we need to verify the same origin policy, is there a way to bypass cross-domain without using the same origin policy? That’s jSONP.

It is possible to bypass the cross-domain approach by loading JS. Such as script tag SRC,img tag SRC.

The server can dynamically concatenate data as long as it is in HTML format.

cors

Option preview

1. What is precheck

A cross-domain request can be initiated normally, but the result returned is blocked by the browser

2. When does precheck occur

3. Demo1 (head fields other than the set of head fields that are artificially set to be safe for CORS)

4. Demo2 (Content-type is not simple request)

5.cookie

proxy

index.html

Enable proxy.js to proxy port 8888 to port 4567

App. js Enable port 4567 service

Nginx reverse proxy configuration

Forward agent

A classmate on the road to his business, he is currently one of the biggest problems is the start-up capital, so he decided to look for the horse dad to borrow money, you can imagine, finally touched A rebuff came back, the feeling be nasty under, he thought of A way to find A relationship line, after A message asking for, the original is A classmate of university teacher wang A horse dad classmates, So A students find Teacher Wang, wang teacher to help Ma Yun that borrow start-up capital, of course, the last thing became. However, Ma’s father did not know that the money was borrowed by A, ma’s father lent it to Mr. Wang, and Mr. Wang finally handed it over to A. Teacher Wang here played A very key role in this process, which was the agent, or the forward agent. Teacher Wang handled this matter on behalf of student A. In this process, Father Ma did not know who the real borrower was, which was very important.

We often say that the proxy is only forward proxy, forward proxy process, it hides the real request client, the server does not know who the real client is, the client requested services are replaced by proxy server to request, some scientific Internet tools play a typical role of forward proxy. You can set up a proxy server in a foreign country and ask the proxy to request Google.com for me. The proxy returns the corresponding structure to me.

The reverse proxy

Dial 10086 customer service phone, may be a region of 10086 customer service has several or dozens of, you never need to care about what is on the other end, call what, male, or a woman, beautiful or handsome, you don’t care, you care about your problem can get a professional solution, you only need to dial the 10086 operator number, There’s always someone on the other end of the line who will answer, sometimes slowly, sometimes quickly. So the switchboard number 10086 here is what we call a reverse proxy. The customer doesn’t know who the real service provider is.

The reverse proxy hides the real server. When we request www.baidu.com, it’s just like dialing 10086. There may be thousands of servers serving us, but you don’t know which one it is, and you don’t need to know. Ww.baidu.com is our reverse proxy server. The reverse proxy server will help us forward requests to the real server. Nginx is a very good reverse proxy server for load balancing.

The difference between

The difference between the two proxies is that the forward proxy objects are clients, and the reverse proxy objects are servers.