Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,157,163 members, 7,832,853 topics. Date: Sunday, 19 May 2024 at 11:33 AM

Backend Devs Please Help Me With A Cors Error - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Backend Devs Please Help Me With A Cors Error (628 Views)

Pro JS Devs, Please Is This Variable Chaining / So There Are Devs That Earn Up To 30k USD. / Backend Devs How Do You Advertise Your Skills? (2) (3) (4)

(1) (Reply) (Go Down)

Backend Devs Please Help Me With A Cors Error by Tobedated(m): 5:08am On Dec 18, 2022
I'm trying to make a post request to a server but I keep getting this error

Content-Type is not allowed by Access-Control-Allow-Headers

I've tried adding content-type and access-control-allow-origin to the Access-Control-Allow-Headers at the backend but it still brings up the same error

Searched on Google and I couldn't find a working solution

Please do you know the solution
Re: Backend Devs Please Help Me With A Cors Error by Codepain: 5:56am On Dec 18, 2022
Let's see your code. It's a common error it should be easy to solve
Re: Backend Devs Please Help Me With A Cors Error by Tobedated(m): 8:48am On Dec 18, 2022
Codepain:
Let's see your code. It's a common error it should be easy to solve

Re: Backend Devs Please Help Me With A Cors Error by thug: 9:11am On Dec 18, 2022
install cors and use it as a middleware
Re: Backend Devs Please Help Me With A Cors Error by QuoteJustOnce: 12:34pm On Dec 19, 2022
app.use(cors()) will help you, use all you want during your development... but unsafe for production

for production, something more like below is sufficient.

https://i.imgur.com/2mJG5Uw.png

Then pass the delegate to it, like so
app.use(cors(corsOptionsDelegate))
Re: Backend Devs Please Help Me With A Cors Error by Sleekcode: 10:14pm On Dec 19, 2022
QuoteJustOnce:
app.use(cors()) will help you, use all you want during your development... but unsafe for production

for production, something more like below is sufficient.

https://i.imgur.com/2mJG5Uw.png

Then pass the delegate to it, like so
app.use(cors(corsOptionsDelegate))




You forget to tell him at the top of his code before making any request

(1) (Reply)

Please, Does Anyone Know How To Connect Javascript To A PHP Socket Server On A L / Call For Your Latest I.T Certification Dumps. / Become A Programmer In Port Harcourt!

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 10
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.