AM Coder - Making Your Own Proxy Server to Avoid CORS Errors

  Рет қаралды 14,583

Web Development with Alex Merced

Web Development with Alex Merced

Күн бұрын

Пікірлер: 44
@davidconnelly
@davidconnelly 3 жыл бұрын
You are a good teacher and with a few simple tweaks I think you could be an outstanding teacher. I won't patronise you by giving you advice you never asked for but well done! That was cool.
@bianbread
@bianbread Жыл бұрын
you have my love. thank youuuu so so so much! I lost 2 days on that cors problem & I was about to fall into some depression from not being able to solve it (despite the many tutorials i saw on proxy servers )
@andrewperez7844
@andrewperez7844 3 жыл бұрын
Thank you so much for this. Had no knowledge of the backend yet, and this content solved the problem I was having for a couple hours 😅
@bezimiennygrzes5593
@bezimiennygrzes5593 2 жыл бұрын
love it, searched about it so long and you explained it so simple :) i hope i will learn from you alot
@NYC_CuriousG
@NYC_CuriousG Жыл бұрын
It’s hard to find a solution for CORS & Wordpress. This video helped me understand it a bit more. I wished you showed us the error first and then fixed it.. Thanks though!
@WolfeezyProof
@WolfeezyProof 2 жыл бұрын
Fantastic solution! Trying to learn and get my head around everything, and I've found gold in your channel :) Subbed!
@ferreolduboiscoli
@ferreolduboiscoli 10 ай бұрын
Just THANKS !!!
@ahmadhaikal9734
@ahmadhaikal9734 2 жыл бұрын
Yooooooo!!! you just save my life!!! thank you for this video!!!!!
@bardiaazari6162
@bardiaazari6162 Жыл бұрын
Thanks for this great video👍
@asylux1096
@asylux1096 3 жыл бұрын
I like this tutorial however, I'm not quite that advanced. What I am trying to do is make a cors proxy that allows me to run Logseq, which on their site recommends an isomorphic-cors proxy, which I just can't seem to get to work. The question I have is if you have a web app, like Logseq, that requires you to add a Custome CORS proxy server in the advanced area, is this possible using this method? And if so, what would I paste into the ( const response = fetch () ) area of the code. It's that part that confuses me. Thanks. Great tutorial by the way! I work mostly in GO these days, so I'm ok in Javascript but not that great. lol
@AlexMercedCoder
@AlexMercedCoder 3 жыл бұрын
I think I have a newer video on this, but you could make a proxy server with a Go framework like echo. Just deploy a micro service that solely has one route that when request makes the request to the Logseq and returns the results in the response then you won’t need JS to do it
@asylux1096
@asylux1096 3 жыл бұрын
@@AlexMercedCoder Thanks. I'm working that out now. Subscribed and looking forward to your the video
@AlexMercedCoder
@AlexMercedCoder 3 жыл бұрын
@@asylux1096 kzbin.info/www/bejne/rXSyZY2Cf6p3eJo
@ring11037
@ring11037 5 ай бұрын
Does this solution work with POST method?
@muhammadazlaanzubair5426
@muhammadazlaanzubair5426 2 жыл бұрын
Thanks for this man
@Mohammedasif-su5fc
@Mohammedasif-su5fc 2 жыл бұрын
Thank you so much sir finally resolved
@JosephCox
@JosephCox 3 жыл бұрын
How would this change with a POST instead of a GET?
@AlexMercedCoder
@AlexMercedCoder 3 жыл бұрын
You’d make a post route in express that in turn makes a post request to the third party api
@JosephCox
@JosephCox 3 жыл бұрын
Thanks!
@ankurkumar4552
@ankurkumar4552 3 жыл бұрын
Thanks a lot for this video. :)
@canalradionov
@canalradionov 3 жыл бұрын
how do I add the server.js file to my app.js in react?
@AlexMercedCoder
@AlexMercedCoder 3 жыл бұрын
You can’t, it would be seperate express app to act as a go between, if your using Netlify or Vercel you can use their serverless functions feature. Watch my video on Vercel functions or Netlify functions that may be the better alternative to creating a proxy
@canalradionov
@canalradionov 3 жыл бұрын
@@AlexMercedCoder would you mind in elaborating a little more? i'm actually front end dev and just trying to make an api work in my js
@AlexMercedCoder
@AlexMercedCoder 3 жыл бұрын
There is NO way to reliably work around CORS protections in the browser the ONLY way is to write some backend code somewhere that makes the API call outside the browser which means either your own mini backend app (proxy server) or using Serverless functions. Either that or use another API.
@magicmermaidasmr
@magicmermaidasmr 2 жыл бұрын
@@AlexMercedCoder How separate express app will help react app to connect to backend?
@AlexMercedCoder
@AlexMercedCoder 2 жыл бұрын
@@magicmermaidasmr well, the story here is that cors doesn’t apply to sever -> server requests only to Frontend -> server requests so by doing the cors blocked requests from an express server you avoid the cors blocking, then you can make sure the express app has the right cors permissions for your react app to make a request. The result is React -> express server -> cors blocked api The express server (or any backend server) interjects in the middle to make the call to the api and then return the data
@paras5197
@paras5197 2 жыл бұрын
thank you!!
@Pspisripoff
@Pspisripoff 3 жыл бұрын
so i need to install stuff to make this work? I cant just make it simpler?
@AlexMercedCoder
@AlexMercedCoder 3 жыл бұрын
What you trying to make work
@Pspisripoff
@Pspisripoff 3 жыл бұрын
​@@AlexMercedCoder Im accessing API from a dictionary with React, but unless I have CORS plug in or I use that slow link before the API link,, i cant access the data.. Fetch 33.. So, I m trying to find a way to make a proxy without multiple files, installing dependencies and such things.. Is there a way?
@AlexMercedCoder
@AlexMercedCoder 3 жыл бұрын
@@Pspisripoff you can use cors anywhere which are pre-built proxybserers fr basic requests, just google does anywhere
@Pspisripoff
@Pspisripoff 3 жыл бұрын
@@AlexMercedCoder You mean CORS plug in? What if I upload my app as a website? Or you mean that "link" you add in front of the API link?
@AlexMercedCoder
@AlexMercedCoder 3 жыл бұрын
@@Pspisripoff you mean like a chrome extension plugin, avoid those. They fix the problem on your computer but doesn't fix it for other people visiting your site which can be misleading. Cors errors can only truly be fixed by either, the creator of the API adding the appropriate headers to their API for the level of openness they want or a proxy server.
@abdoahmed1231
@abdoahmed1231 2 жыл бұрын
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. I was using apache server and squid
@africanchina1
@africanchina1 2 жыл бұрын
Solution at 3:20
@mdmohiuddin3141
@mdmohiuddin3141 3 жыл бұрын
what about setting up a websocket server
@AlexMercedCoder
@AlexMercedCoder 3 жыл бұрын
Haven't tried it
@AlexMercedCoder
@AlexMercedCoder 3 жыл бұрын
I think I have a video on socket.io somewhere
@gevorggevorgyan8099
@gevorggevorgyan8099 13 күн бұрын
I don't have listen
@deabitist
@deabitist 2 жыл бұрын
its not working
@deabitist
@deabitist 2 жыл бұрын
I don't understand why there are so many good comments here, I tried it with several public APIs and none worked
@michaelbrown7667
@michaelbrown7667 2 жыл бұрын
MVC!
@abdoahmed1231
@abdoahmed1231 2 жыл бұрын
I can contact you please I have a video that shows what I mean
AM Coder - Demonstration - merced-express - Ruby on Rails like Express Generator
9:36
Web Development with Alex Merced
Рет қаралды 62
React Proxy | Easiest Fix to CORS Errors
15:52
Sam Meech-Ward
Рет қаралды 90 М.
My Daughter's Dumplings Are Filled With Coins #funny #cute #comedy
00:18
Funny daughter's daily life
Рет қаралды 32 МЛН
小蚂蚁会选到什么呢!#火影忍者 #佐助 #家庭
00:47
火影忍者一家
Рет қаралды 115 МЛН
REAL 3D brush can draw grass Life Hack #shorts #lifehacks
00:42
MrMaximus
Рет қаралды 11 МЛН
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33
火影忍者一家
Рет қаралды 127 МЛН
Build an API Proxy Server - Hide Your API Keys, Rate Limiting & Caching
32:20
Why I No longer Hate CORS and Why you should too!
13:10
CoderOne
Рет қаралды 17 М.
This Fixes CORS
13:02
Colby Fayock
Рет қаралды 4,1 М.
How to Fix The Cors Error with a Reverse Proxy
18:26
CraigGoesCoding
Рет қаралды 14 М.
How to Solve CORS error in a React app
39:07
Coders Campus
Рет қаралды 22 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 481 М.
Are Windows "Generic Keys" illegal?
13:26
ThioJoe
Рет қаралды 100 М.
How To Solve Any CORS Error
8:03
PedroTech
Рет қаралды 30 М.
My Daughter's Dumplings Are Filled With Coins #funny #cute #comedy
00:18
Funny daughter's daily life
Рет қаралды 32 МЛН