React Security - Add an API Proxy

preview_player
Показать описание

In this lesson, we add an API proxy to our React application. This allows us to make requests to our API over the same domain as our frontend and is necessary if we want to send cookies.
Рекомендации по теме
Комментарии
Автор

Thanks! WOW, even works with webpack, all you gotta do is specify the proxy in the devServer and you're all good! Thanks once again!

flxndwk
Автор

If you could do this WITHOUT create-react-app you would be my hero. The "proxy" doesn't work.

tarsier
Автор

This video is a life saver. Brilliant. Thank you!!

aboutdotnet
Автор

That's a great solution for the dev environment, but how about when we deploy will we need to change from localhost:3001 to the cloud server URL? Will the proxy work in this case? 😊

abedaarabi
Автор

thanks a lot. i finally got cros problem solved, I used the module proxy middleware.

web
Автор

Do you have experiance with full stack development and Cloud Architecture?

ashsharp
Автор

Great concise video! A quick question, how would you serve this in a server for example I have an a react app that has pages as components as well as a server js file for api calls like your video and a proxy setting like yours but in iis how do I serve both my index file and server js file calls in my web config file? Because you wouldn’t use proxy in production right? Any help would be amazing

adila
Автор

It worked at first...But for some reason the proxy is not working anymore...
how to fix this?

mdridoy-efpw
Автор

My project didn't have a file .env.local so I created it, but proxy not helps. Client run on different port 3002 and express-server on 3001

olegmaz
Автор

what to do, if we want to host it on other hosting, how to prevent CORS

shabankhan
Автор

but why do we need proxy to have cookies work properly? any external api will simply store the cookies in the client's browser, without the use of the proxy. that should itself work just fine...am i missing something?

werewasyo
Автор

This doesn’t expose the env on client side?🤔

anandhukraju
Автор

Hey that's great, what about if I need to call more than one api with different domains, this solution wouldn't work. I'm facing that problem right now, I'm using http-proxy-middleware, but the browser blocks the cookies and sessions. What could you advise me? Thanks by the way.

victorpotes
Автор

Hello good afternoon! Adding the "proxy" in package.json is when we are in dev stage, how can we keep the functionality when we deploy?

LuisRamirez-dxid
Автор

Never ever should we use proxy like this, Bad practice

creativetech
Автор

I have a question please When I use a proxy server and I follow people on Instagram, the follow-up is not done, for example, I have 5 followers on Instagram and I request to follow 100 people, that account is not done, they are still following 5 people, I just want to know how this happens, can the effect of the reverse proxy or forward proxy or requests sent can be redirected please help me

abdoahmed