React Proxy | Easiest Fix to CORS Errors

Поделиться
HTML-код
  • Опубликовано: 8 фев 2025

Комментарии • 165

  • @HarshKanjiya
    @HarshKanjiya 2 года назад +60

    sir, 4 hour,its 8:25AM, i was trying to solve this from around 3:30AM. you cant imagine how happy i am right now to find those 4 line of code in ur first 10 sec of video...... i love you man even turned on bell icon cz u saved my project, i was about to delete it

  • @niranjans.r1930
    @niranjans.r1930 9 месяцев назад +7

    Unlike every other youtubers who says bunch of nonsense and non related things before giving the actual information for which we came for, You gave the most important information in the first 10 seconds and proceeded to explain it later. You have our respect.

  • @---qp8bs
    @---qp8bs Год назад +8

    This entire list of react focussed videos is great, It is obvious you spent a huge amount of energy on taking us along on the learning curve- just compare the first couple of videos to this, it's a great expansion building on the previous knowledge!
    This video really blew me away with the quick deployment on railway, that's awesome.
    Also loving the quick snippet at the start showing the main point!

  • @knecks7374
    @knecks7374 Год назад +2

    bro after 2 and a half hours of struggling around , i had lost my hope. and the i decided to watch this full video as my last tether to sanity. and that stupid failed to fetch error is finally gone. thank you dude. god bless you.

  • @krishangsharma2185
    @krishangsharma2185 Год назад +1

    I was so stressed out about the whole CORS issue, and this, this is just gold. Straight and to the point explanation! Really appreciate the work!!!

  • @tiktaktictac
    @tiktaktictac 2 года назад +6

    This clears up a lot for me man. This is the first time I try to make a fullstack app and all these deployment issues are confusing af. Thumbs up for you 👍

  • @amouzande9102
    @amouzande9102 10 месяцев назад

    Thank you so much for this tutorial, I've searched lots of videos and site but none of them specified exactly how to solve it in vite. really appreciate it Sam

  • @oyivosamuel7185
    @oyivosamuel7185 Год назад +1

    I dont really know u and this is my first time of watching ur video but ur video just saved me after 4 days of trying to connect my vite React project with my node js without using cors.......U are a life saver for that am subscribing......thanks again

  • @siddhantsrivastav8591
    @siddhantsrivastav8591 Год назад +4

    Really awesome video. Telling the solution at start and then it's upto the user to say. Love it man! Hope to see more youtubers be this thoughtful

  • @mrmaahi4945
    @mrmaahi4945 9 месяцев назад

    I never thought that I can solve my intital (proxy setup) and final (deployment) problems by just watching one video.
    Spent all day trying different way to deploy my project but lost functionality after deployment. Finally deployed using the process in the video and everything is working sooo fine and it's soo easy. I can't thank you more, u really saved my day here and explanation is on point that made me think like, "what the hell, I understand everything this guy saying" . THANK YOU SO MUCH

  • @number5322
    @number5322 2 года назад +2

    I spent a whole night trying to circumvent those cors issues. Thank you very much. Now I'll go get some sleep

  • @juanguerrero0941
    @juanguerrero0941 Год назад +1

    I needed a solution as fast as possible, I looked a lot of videos that didn't help me, but this one in the first 30 seconds gave me the answer, thank you

  • @charlesbrz
    @charlesbrz 5 месяцев назад

    I am a bit clueless. But this guy pushed me in the right direction in a way I could understand. Your work is greatly appreciated

  • @Asad_The_Second
    @Asad_The_Second 6 месяцев назад

    If only all tutorials were this thorough.
    Thanks for the video

  • @jaitjacob
    @jaitjacob Год назад

    you make videos of things I've wondered about at some point during my learning process, so good! this cors issue was something I fixed using an extension without really paying attentions to the whys and how's

  • @Šuki-z4c
    @Šuki-z4c Месяц назад

    THANK YOU! I was stuck on this for so long. I figured out how to make it work in development but when i had to deploy I could not make it work. When I heard you mention that I can just serve my dist files from my back end, thats when I figured it out. My app now works in prod!

  • @ashharSartaj
    @ashharSartaj 2 года назад +5

    Can't thank you enough brother. After almost 4 hours of frustration, got the appropriate solution. Also, CORS package wasn't fulfilling the purpose, as suggested by other channels.

  • @avalanche-arabic
    @avalanche-arabic 2 года назад +2

    Thank you so much, after a week of search i got my issue fixed and finally the data renders on my frontend up! Keep up the great work! Thank again!

  • @krzysztofkrawczynski9404
    @krzysztofkrawczynski9404 5 месяцев назад

    14 seconds of video pointed me into right direction. Thank you!
    Those CORS configurations are pesky . Local frontend, local backend, GitHub, remote frontend, remote backend, DEV, TEST, PROD - all permutations turn development into a quagmire. Thank you for the explanation.

  • @HariRavi
    @HariRavi 4 месяца назад

    Thank you so much bro for telling the answer in the first 10 seconds. You really are a saviour.

  • @spab87
    @spab87 5 месяцев назад

    THANKS A LOT!!! (I've been trying to fix this bug for couple of hours, installed nginx, like a billion of cors expansions and set everything on my Flask server... thanks for explaining it all

  • @FaySaud-j3l
    @FaySaud-j3l 11 месяцев назад

    Thank you so much , you can’t imagine how grateful I am for this clearly instructed solution,I’ve been stuck on this CORS issue for 3 days and went through a lot of solutions and videos but yours is what worked best for me 🙏 thank you again

  • @VisionRevealed
    @VisionRevealed 4 месяца назад

    Hi, thank you sam for the videos, really amazing content, best practices, great explanation, good energy. I appreciate everything!
    Here are few tips if you are using the proxy on vite:
    - after setting up the proxy, make sure you have /api/example endpoints on your server, because if not, when you build your project the http requests will be send to /api/* endpoints and if they don't exist in your server, that will cause an error;

  • @itchybakerzz5101
    @itchybakerzz5101 Год назад

    I've been looking for a solution about the proxy in vite-react for days, then this video solved it within 20 seconds. Thanks a lot!

  • @vinodpatil7314
    @vinodpatil7314 10 месяцев назад

    sir from past 2 days i spent all midnight just chatgping the proxy thing and today just at 0:13 i got the solution thank you so much

  • @ДмитрийБондарь-ж1у
    @ДмитрийБондарь-ж1у 5 месяцев назад

    Thank you! Excellent explanation with real examples. It really helps me to fix my issue and understand the problem.

  • @CoFloCipher
    @CoFloCipher 2 года назад +1

    Just wanted to say this helped me in a bind. Thank you!

  • @danielcinspace1
    @danielcinspace1 Год назад

    The first video I have ever commented on. CORS was driving me nuts. Thank you!

  • @4xsjb
    @4xsjb 9 месяцев назад

    What a legend , i've been stuck with this for 3 days . it almost seemed impossible to solve then this video showed up when i was just scrolling 😄

  • @stalinengoma7680
    @stalinengoma7680 5 месяцев назад

    Thank you for explaining this.
    I thought we have to use CORS in the backend and the Proxy in the frontend o mmake it work but your video just cleared my doubts

  • @Hadrian-w9c
    @Hadrian-w9c Год назад

    Dude, this vid saved my butt.... spent ages trying to solve a proxy issue... Sub'd!

  • @chrisdan81
    @chrisdan81 Год назад

    thank you for this... I have been searching for this for 4 hours ...

  • @explorelifewithleo
    @explorelifewithleo Год назад

    This video clears all my doubts about proxy server. amazing content!!

  • @ankush1228
    @ankush1228 Год назад

    i literally spent 2 days on cors and hosting but you made it in 15 min thanks man🥺🥺🥺

  • @OgbonnaBlessed
    @OgbonnaBlessed 5 месяцев назад

    Thank you so much for making this video sir, it actually helped solve and clear the error I was encountering.
    Thank you so much sir.

  • @sagarchawla4926
    @sagarchawla4926 2 года назад

    Amazing dude, i was stuck for a whole day figuring out whats wrong.

  • @74LS_NE555
    @74LS_NE555 Год назад

    thank you for getting to the point from the start [subbed]

  • @MatthewMcGuff
    @MatthewMcGuff Год назад

    I really like this pattern for building full stack react and node applications. Thanks for the video.

  • @harshitprasad1064
    @harshitprasad1064 Год назад

    God bless you man!!! Thank you very much for sharing what I was looking for in the first 10 seconds of the video instead of scattering it throughout the video... ❤

  • @vlogs627
    @vlogs627 Год назад

    Thanks. It saved my 4 hours of headache.

  • @rogut8
    @rogut8 2 года назад +1

    Wow, that was fast mate. Thank you Sir :)

  • @c1ach027
    @c1ach027 Год назад

    Thanks you ^^,I find this pbm with my Java Spring api and Vuejs, after your tutorial it's work. Your the best ^^

  • @WohSaadgi
    @WohSaadgi 6 месяцев назад

    Thank you very much Sir for this Important and deep understanding video

  • @jaisikadhiman9791
    @jaisikadhiman9791 8 месяцев назад

    Thanku , after wasted of 2 hours i found the solution of this problem thanku😊

  • @javiergarciafillol4454
    @javiergarciafillol4454 Год назад

    Grath, a simply solution for the express & proxy develop

  • @aliyazdan6282
    @aliyazdan6282 11 месяцев назад

    wow it was such a amazing video it got my lot of doubts cleared

  • @SékouDayifourouKeïta
    @SékouDayifourouKeïta 5 месяцев назад

    You're a master bro. Keep going ❤

  • @FunkyLPify
    @FunkyLPify 2 года назад

    Thanks very much for the video! Got a bit confused why some other tutorials like uploading an image to S3 didn't work for me with the way you did it, but it was because of the missing proxy haha

  • @DeepakisDemigod
    @DeepakisDemigod 6 месяцев назад +1

    God Bless You ❤❤❤

  • @linak1909
    @linak1909 9 месяцев назад

    omg this is amazing XD immediately subscribed!

  • @nikolaradulovic9145
    @nikolaradulovic9145 Год назад

    Valuable content, thanks for sharing knowledge!

  • @omarkabbara6759
    @omarkabbara6759 Месяц назад +1

    Very usefull

  • @teminoah2960
    @teminoah2960 Год назад

    thanks Mr Sam , this absolutely helpful .

  • @mehrosenasir9974
    @mehrosenasir9974 Год назад

    Thank you so much from Pakistan!!

  • @akashddeepchitransh4537
    @akashddeepchitransh4537 8 месяцев назад

    Incredible video learned a lot

  • @jawadsaleem7495
    @jawadsaleem7495 5 месяцев назад

    You are a life saver vruhh...

  • @eLuars
    @eLuars 4 месяца назад

    you are my new God now 😀

  • @watcharaponhongthong7869
    @watcharaponhongthong7869 6 месяцев назад

    Very clear! Thanks:)

  • @abhishekvishal354
    @abhishekvishal354 Год назад

    Thank u man so much ....
    This vid was a blessing

  • @Geekoo
    @Geekoo Год назад

    Wow I can't ask more than this

  • @peyy7645
    @peyy7645 7 месяцев назад

    Sir, U saved my life 😭😭

  • @triviachanel
    @triviachanel Год назад

    Thanks man, you save my life.

  • @sambashivaraoboyina3191
    @sambashivaraoboyina3191 7 месяцев назад

    Excellent explanation

  • @gonzalosandivaras9986
    @gonzalosandivaras9986 3 месяца назад

    Love you man! Thanks!

  • @111ramico
    @111ramico 11 месяцев назад

    Thank you
    it was delighted 🙂

  • @crypto1886
    @crypto1886 10 месяцев назад

    Thank you, you have recived my sub and like

  • @AnsonBenny
    @AnsonBenny Год назад

    Tnks bro its working very well, keep going👍

  • @mubashirwaheed474
    @mubashirwaheed474 2 года назад +3

    Thank you, Sam, for explaining that we have our own backend, but what about the case in which we are using third-party API?

    • @SamMeechWard
      @SamMeechWard  2 года назад +2

      This method only works if you're serving your react app from the same backend that you're making requests to. So you wouldn't be able to do this with a third party API, but those should already have the correct CORS configurations to allow you to make requests.

    • @mubashirwaheed474
      @mubashirwaheed474 2 года назад +1

      @@SamMeechWard The API endpoint I was using didn't have CORS configured so I used a proxy to fix the issue
      Thanks

    • @pjborowiecki2577
      @pjborowiecki2577 2 года назад

      @@SamMeechWard Thank you so much! Glad to have found your video and it helped me a lot. The only issue I am facing now is that this way, other routes (e.g., /admin) won't work after build - I am seeing "cannot GET /admin" messages. Routing works perfectly fine in development and I am using React Router Dom v. 6. Would you be so kind to explain this or point in the right direction? Thanks again!
      EDIT: Think I just solved it by adding
      app.use("/admin", (req, res) => {
      res.sendFile(path.join(__dirname, "dist/index.html"));
      });
      to my server. Not sure whether this is a correct approach, but it does the trick. Still, Would love to hear how you would solve this. Thanks!

    • @kenthugo
      @kenthugo 2 года назад

      @@mubashirwaheed474 Have you fixed the issue? I have tried using the video's fix but it does not work in Production.

    • @mubashirwaheed474
      @mubashirwaheed474 2 года назад

      @@kenthugoin order to fix my issue I used the netlify's serverless function to create a proxy (express server through which request is made to the api and then proxy -backend- send the data to the frontend

  • @kishoreandra
    @kishoreandra 2 года назад

    Waoh thanks for the video Sam 🙌 subscribed 😉

  • @user-fy2hp
    @user-fy2hp Год назад

    Thanks that's a great helpful information

  • @thesoftwareengineersjourney
    @thesoftwareengineersjourney 2 года назад

    Thanks I was able to fix a problem with this

  • @scey
    @scey Год назад

    thank you so much! perfect!

  • @yoslandymesa5560
    @yoslandymesa5560 Год назад +2

    Hi Sir. The tutorial is great, but I got catch for the plugin that helps you to complete code, I think you call it Copilot, but I see so many copilot on VS code. Could you be specific which one are you using?

  • @maksymstarodubtsev6704
    @maksymstarodubtsev6704 7 месяцев назад

    thanks, it helps a lot

  • @fabianvieri1907
    @fabianvieri1907 2 года назад +1

    Great vids, one thing is there a way to automate the build process?

  • @matteonegridev
    @matteonegridev 2 месяца назад

    Hey, really great video that made you gain a subscriber~! I have a question tho, will it work the same way with post request (if we want to gather email from form submission into our server) when in production? I set up a server and in development once i start my server (obv) everything work fine: I'm able to gather info from the input, but what about production if I wanna make it work under the hood constantly? Thank you!

  • @Booheymen1410
    @Booheymen1410 4 месяца назад

    U save my day

  • @KCODivyanshuKatyan
    @KCODivyanshuKatyan 11 месяцев назад

    which extensions are you using for auto complete? nice explaination btw.

  • @zihuatanejo7741
    @zihuatanejo7741 2 года назад

    Thanks a lot, great video :)

  • @adrn_en
    @adrn_en Год назад

    Thankyou so much!

  • @StefanoMercadante
    @StefanoMercadante 8 месяцев назад

    thank you thank you very much!!!!!

  • @ELMlKO
    @ELMlKO Год назад

    real hero

  • @chinwubachukwudi4483
    @chinwubachukwudi4483 2 года назад

    Thank you so much mate

  • @harshlohana
    @harshlohana Год назад

    Awesome video!

  • @toluwanimiala4729
    @toluwanimiala4729 9 месяцев назад

    great vid 🤌

  • @dhaouiaziz6611
    @dhaouiaziz6611 Год назад +1

    should i remove the proxy in prod ?

  • @soundx-q7n
    @soundx-q7n 2 месяца назад

    So proxying like this is perfectly safe to do in deployment?

  • @KhushalMali-pf6fv
    @KhushalMali-pf6fv 7 месяцев назад

    Thank you sir

  • @vishnuk9628
    @vishnuk9628 2 месяца назад

    my frontened is react js and .net core is backend, i hosted backend in server but i didnt able to connect local react to core due cors error, after this video it solved
    but my question u did chnage on development server.js but i dont have such file where i do the chnages??
    also what is express in that command ?
    help me

  • @mamory2101
    @mamory2101 2 года назад

    What would be a suggested way to do this?

  • @Lunolux
    @Lunolux Год назад

    great video, thx

  • @jokerbanny
    @jokerbanny 2 года назад

    Thack Thank Thank you very much ! 🥳

  • @suyogsinnarkar3614
    @suyogsinnarkar3614 Год назад

    thank you bro

  • @nepon2101
    @nepon2101 2 года назад

    Thank you man

  • @abirhal2391
    @abirhal2391 Год назад

    i add proxy on packaj.js and when i run npm start i get this
    Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
    - options.allowedHosts[0] should be a non-empty string. how i can solve it , i spend 3day on it

  • @CuriousAnonDev
    @CuriousAnonDev 2 года назад

    Thank you Sam :)

  • @isaacjames8735
    @isaacjames8735 4 месяца назад

    I tried Using React Router in this method but if did not work???

  • @vladimirkuzmenkov7285
    @vladimirkuzmenkov7285 Год назад

    jeez man, you sure have huge eyes
    P.S. Thanks it helped!

  • @shabariks7735
    @shabariks7735 11 месяцев назад

    i am just using normal react app even though i set it is still showing those error i am using vercel to deploy is there is any other way to fix those

  • @zarefgamz2515
    @zarefgamz2515 Год назад

    vite proxy doesn't change axios configuration