C
C#slezyradosti

Request header field content-type is not allowed

I have a third party API which uses SOAP + xml. I want to send a post request. Using Postman I can make this request without any problems. However, I cannot send it with JQuery, getting an error: Access to XMLHttpRequest at '[api link]' from origin '[localhost]' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.
No description
No description
No description
J
Jimmacle16d ago
CORS issue your server needs to communicate to the client that it's allowed to use those headers postman doesn't care because its whole purpose is to make non-origin requests, but browsers care because that's a vulnerability
S
slezyradosti16d ago
Is there anything I can do on client side to solve this issue?
J
Jimmacle16d ago
no
S
slezyradosti16d ago
funny
J
Jimmacle16d ago
the server has to communicate CORS policies that allow the client to make those types of requests
S
slezyradosti16d ago
is it 1st aplir task if I use other browser?
J
Jimmacle16d ago
probably not it's a security feature that's turned on by default
S
slezyradosti16d ago
Sorry, want to clarify some things. By using CORS sever protects itself, right? So why Postman can go over the protection? I mean, if Postman can, then server is not as protected..
J
Jimmacle16d ago
no, by using CORS the browser protects you from malicious sites making requests to other websites on your behalf postman can go over it because it doesn't care browsers care basically, CORS is the server telling the browser that the website you're currently on is allowed to make requests to it
S
slezyradosti16d ago
yeah, that is why I asked about protection from Postman sounds confusing to me
J
Jimmacle16d ago
MDN Web Docs
Cross-Origin Resource Sharing (CORS) - HTTP | MDN
Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources. CORS also relies on a mechanism by which browsers make a "preflight" request to the server hosting the cross-origin resource, in ord...
S
slezyradosti16d ago
Thank you
Want results from more Discord servers?
Add your server
More Posts
Rectangle intersection not workinUsing the code provided, I've tried the ways I knew to make the tripods remove once they're hit by aFeeding Random into itself - does it "corrupt the randomness"?If I am to reinitialize an instance of System.Random after every .NextDouble() using the return valuUpdate and add to Resource.resx file via code.We are adding localization to our product and want to automate the process of updating the resx fileWinform project saves the Image with a black backgroundIt works perfectly except it creates a black background which isn't shown in the picturebox preview,✅ Theoretical question. MediatR and DTO and onion structureHello, THe following is just theoretical and I do not need any code In the programming world, transfStack overflow exception when closing one formCan't seem to find the issue.. I have a startscreen, and when any key is pressed on startscreen it tAdvice / Guidance on VM application services (Windows Server 2016)Has anyone every come across a virtual machine (3 virtual 2.6Ghz processors, 12GB Ram) where a singlCan anyone help me with the odd prime numbers program?Facing difficulty in college assignment.IndexOutOfRange Leetcode helpHey, having an issue with my leetcode problem. I know that its supposed to be a bitwise XOR operatiovisual studio .net core ironPDFi have problem with export to pdf files. It's works perfectly( create a files and change keyword), bVisual Studio + WPF: "Could Not Load Assembly" despite dlls being available and reference correctThis has been driving me nuts for a day now. It's an intermittent error as had this working fine at how to export datas to json file from mysqlI have datas in mysql I want to move them to a json file. How can I do that?Licensing my programHi, i’m developing a Point Of Sale software and would like to find out possible solutions to manage ✅ Unhandled exception. Cannot print exception string because Exception.ToString() failed.justwhy this error always come in dotnet webapi application version ----- dotnet --version ✅ How to use Dapper with Query ParametersI work a lot with SQL databases such as MySQL, SQLite and PSQL and usually I write my Queries like t✅ transaction in transaction issueI have this error: `The connection is already in a transaction and cannot participate in another trHelp making login function c#Im currently trying to code a login function I have the registration my user is getting saved in thProblems with docker and my app imageI already posted a question that more or less manage to solve but now i have other problem, the thiAttempting to get value from different JSON files with variable keyHello o/ I am attempting to deserilize and obtain the value from a variety of JSON files that contaiHow to display only department fields associated with a selected department in student automationhi, I'm facing a challenge while working on the student automation system. After selecting the depar