You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-14Lines changed: 21 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,11 +69,11 @@ Usage with jQuery
69
69
70
70
```JAVASCRIPT
71
71
$.ajax({
72
-
url:'proxy.php',
73
-
cache:false,
74
-
headers: {
75
-
'X-Proxy-URL':'http://example.com/api/method',
76
-
},
72
+
url:'proxy.php',
73
+
cache:false,
74
+
headers: {
75
+
'X-Proxy-URL':'http://example.com/api/method',
76
+
},
77
77
})
78
78
```
79
79
@@ -124,12 +124,12 @@ Security
124
124
The hostname of the referer is checked, but can be easily spoofed, so the whitelist array should be put to good use. Fill it with any number of the following types of criterias:
125
125
126
126
- Exact paths
127
-
`['http://example.com/api/specific-method']`
127
+
`['http://example.com/api/specific-method']`
128
128
- Array with single regex key
129
-
`['regex' => '%^http://example.com/api/%']`
129
+
`['regex' => '%^http://example.com/api/%']`
130
130
- Array with any [parse_url](http://php.net/manual/en/function.parse-url.php) components to match
131
-
`['host' => 'example.com']`
132
-
`['host' => 'example.com', 'scheme' => 'https']`
131
+
`['host' => 'example.com']`
132
+
`['host' => 'example.com', 'scheme' => 'https']`
133
133
134
134
The requested URL must match at least one of the whitelisted criterias to be accepted, otherwise a 403 will be returned. The whitelist can also be set to an empty array to allow any URLs.
135
135
@@ -159,13 +159,20 @@ CrossOriginProxy::proxy([
159
159
Cookies
160
160
---
161
161
162
-
Cookies sent to the proxy will be ignored, since the browser will send the ones meant for the domain of the proxy, and not the cookies meant for the proxied resource. So, if a request requires a certain cookie set, for example a session id, you can set the `X-Proxy-Cookie` header which is then used as `Cookie` header by the proxy.
162
+
Cookies sent to the proxy will be ignored, since the browser will send the ones meant for the domain of the proxy, and not the cookies meant for the proxied resource.
163
+
164
+
If a request needs a cookie set, for example a session id, you can set the `X-Proxy-Cookie` header which will then be used as `Cookie` by the proxy.
165
+
166
+
Similarly, any `Set-Cookie` header in the response would be eaten by the browser and not accessible, so the proxy renames any `Set-Cookie` header to `X-Proxy-Set-Cookie`.
0 commit comments