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

feat: implement CORS proxy using Edge Function #103

Merged
merged 2 commits into from
Jul 22, 2023
Merged

feat: implement CORS proxy using Edge Function #103

merged 2 commits into from
Jul 22, 2023

Conversation

azu
Copy link
Owner

@azu azu commented Jul 22, 2023

Use Netlify Edge Function instead of _redirects.
It is controllable proxy.

close #100

@azu azu linked an issue Jul 22, 2023 that may be closed by this pull request
Comment on lines +11 to +12
// Disable CORS Proxy
localStorage.setItem("REACT_APP_CORS_PROXY", "");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can disable default proxy.

Comment on lines +28 to +33
const response = await fetch(proxyReq);
// always no cache
// https://docs.netlify.com/edge-functions/optional-configuration/
const proxiedResponse = new Response(response.body, response);
proxiedResponse.headers.set("Cache-Control", "no-store");
return proxiedResponse;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proxied response always to be no-store.

Comment on lines +8 to +10
REACT_APP_CORS_PROXY="/cors-proxy/"
REACT_APP_INOREADER_ACCESS_TOKEN_URL="https://www.inoreader.com/oauth2/token"
REACT_APP_INOREADER_BASE_URL="https://www.inoreader.com"
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new ENV

@azu azu merged commit 10d5845 into master Jul 22, 2023
@azu azu deleted the feature/100 branch July 22, 2023 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Temporary] Disable Netlify CORS Proxy
1 participant