Help needed with fetch-based networking #1180
-
In the documentation about fetch-based networking it says:
What is meant by "CORS-enabled hosts"? Do you mean HTTP servers that allow/deny requests based on HTTP CORS headers (I figure since it also says that "no external relay is used")? Is it at all possible to use an external relay with fetch-based networking? If it is, how could I run a local relay, preferrably on linux? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Each HTTP server can control whether the client from client's origin host (with this method and headers) can load data from that server or not. "CORS-enabled" host meant that server allows your origin host, headers and method that you use. For example, how this looks on server's response and client's request: // client
GET / HTTP/1.1
Host: example.com
Origin: http://someweb.site // server that allowed CORS
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: *
Access-Control-Allow-Headers: * Server must include these headers or CORS was not permitted.
If you about relay for bypassing CORS, you can replace this line: Line 316 in ba7f940 to this.network_adapter = new FetchNetworkAdapter(this.bus, { cors_proxy: "<http://your-cors-proxy>" });
Look at https://github.com/Rob--W/cors-anywhere For interest, I wrote a simple CORS proxy for Deno that packaged as a one-liner (uses port 8000 by default):
Template for |
Beta Was this translation helpful? Give feedback.
Each HTTP server can control whether the client from client's origin host (with this method and headers) can load data from that server or not. "CORS-enabled" host meant that server allows your origin host, headers and method that you use.
For example, how this looks on server's response and client's request:
Server must include these headers or CORS was not permitted.