Can not send post request. Error text:

The request from an outside source is blocked: The policy of one source prohibits the reading of a remote resource at http: // localhost: 8080 / lambdas . (Reason: preflight CORS channel failure).

How to solve a problem?

  • Browser policy to prohibit cross-domain requests (as well as to another port) - Red Woolf
  • that is, the problem is not in the server? - Mavriky Nikolaevich
  • Well, in general, no, this is just a browser restriction. For security reasons, try sending a data to localhost: 8080 header Access-Control-Allow-Origin: http://siteскоторогоделаетсязапрос.com - Red Woolf
  • I apologize, I'm doing this for the first time) how to add a title? - Mavriky Nikolaevich
  • server part on php? - Red Woolf

1 answer 1

The whole point is that cross domain requests are prohibited for security purposes, but you still need to make such a request, it is required that the server to which the request is made with data sends an additional Access-Control-Allow-Origin header, thereby allowing such requests to it, in detail read here

  • like added, did not help (maybe something else is needed? - Mavriky Nikolaevich
  • Should have helped, check whether the browser sends the header - Red Woolf
  • Yes, it sends, but the post is for some reason replaced with options - Mavriky Nikolaevich
  • I think the link learn.javascript.ru/… will help, and based on cyberforum.ru/javascript-jquery/thread1865586.html it looks like it’s possible to be in the server - Red Woolf