Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Origin header from client not being propagated causing CORs issues in browser #5

Open
deasydoesit opened this issue Jul 4, 2023 · 1 comment

Comments

@deasydoesit
Copy link

deasydoesit commented Jul 4, 2023

In the old Helius architecture, it appears that the Access-Control-Allow-Origin header provided by the RPC proxy was simply propagated back in the response from Helius, preventing CORs issues from occurring on browser-based client applications.

In the new backend architecture, however, the above is no longer the case. Instead, the new architecture now takes the Origin header as provided by browser-based clients and adds it as the Access-Control-Allow-Origin header. In other words, the RPC proxy must either relay Origin headers provided by browser-based client applications, provide an Origin header when proxying browser-based client requests to Helius, or override response headers provided by Helius to include CORs headers (e.g., Access-Control-Allow-Origin) if no Origin is provided.

const proxyRequest = new Request(`https://${pathname === '/' ? 'rpc' : 'api'}.helius.xyz${pathname}?api-key=${env.HELIUS_API_KEY}${search ? `&${search.slice(1)}` : ''}`, {
method: request.method,
body: payload || null,
headers: {
'Content-Type': 'application/json',
'X-Helius-Cloudflare-Proxy': 'true',
...corsHeaders,
}
});

@deasydoesit deasydoesit changed the title Origin header from client not being propagated causing CORs issues in browswer Origin header from client not being propagated causing CORs issues in browser Jul 4, 2023
@y4my4my4m
Copy link

Was this ever implemented? I dont see it in the code, but i see the last update is on the same date as this issue..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants