--- type: video yt_id: VVU2YVRMdUlfajQtMHdpRFN6bWFQY3RRLk40eVVpUWlUdndV videoId: N4yUiQiTvwU title: "React Proxy | Easiest Fix to CORS Errors" date: "2022-08-29T14:00:19Z" slug: "react-proxy-easiest-fix-to-cors-errors" image: name: "react-proxy-easiest-fix-to-cors-errors.jpg" alt: "React Proxy | Easiest Fix to CORS Errors" width: 1280 height: 720 status: 'published' description: "Proxying API Requests in Development using Vite, Parcel, or Create React App. If your plan is to host your react app from the same origin as your web server, then this is super helpful. Conveniently, this also avoids CORS issues. I'll also show you how to deploy your react app using your express server and railway." tags: ['nodejs', 'react', 'react js', 'javascript'] --- Proxying API Requests in Development using Vite, Parcel, or Create React App. If your plan is to host your react app from the same origin as your web server, then this is super helpful. Conveniently, this also avoids CORS issues. I'll also show you how to deploy your react app using your express server and railway. ## Chapters: * 0:00​ Intro * 2:56 CORS * 3:38 Deploying a React App * 7:04 What is React Proxy * 8:10 Adding a Proxy * 11:14 Building the app for production * 13:10 Deploying the app into production * 15:13 Summary ## The Docs * [https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin) * [https://create-react-app.dev/docs/proxying-api-requests-in-development/](https://create-react-app.dev/docs/proxying-api-requests-in-development/) * [https://vitejs.dev/config/server-options.html#server-proxy](https://vitejs.dev/config/server-options.html#server-proxy) * [https://parceljs.org/features/development/#api-proxy](https://parceljs.org/features/development/#api-proxy)