Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,381 members, 7,815,808 topics. Date: Thursday, 02 May 2024 at 06:44 PM

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 (611 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)

I Need Explanation On This Code?? Php Programmers / JAVA For Beginners (conditional If/else Statement) / Programming

(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. 14
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.