preflight

CORS preflight request returning HTTP 401 with windows authentication

谁都会走 提交于 2019-12-01 15:48:19
I searched a lot on Google and Stack overflow to find a solution for my problem, but nothing worked. Here is my problem: I use IIS 7 with a special programming environment called WebDEV that does not allow direct manipulation of OPTIONS HTTP method. So, all solutions suggesting some kind of server-side request handling using code are not feasible. I have to use Window authentication and disable anonymous access I have a page that uses CORS to POST to this server. As this POST should have Content-type: Octet-stream , a preflight is issued by the browser. When I enable anonymous access,

CORS preflight request returning HTTP 401 with windows authentication

浪子不回头ぞ 提交于 2019-12-01 14:56:18
问题 I searched a lot on Google and Stack overflow to find a solution for my problem, but nothing worked. Here is my problem: I use IIS 7 with a special programming environment called WebDEV that does not allow direct manipulation of OPTIONS HTTP method. So, all solutions suggesting some kind of server-side request handling using code are not feasible. I have to use Window authentication and disable anonymous access I have a page that uses CORS to POST to this server. As this POST should have

Angular2 application call node.js function

时光怂恿深爱的人放手 提交于 2019-12-01 11:18:34
Ok so I have an Angular2 application running on http://localhost:4200/ , Inside this app I'm trying to call a function located in a seperate node.js application currently running on http://localhost:3000/ My call from the Angular2 application: deletePhoto(photoId: string) { var options = new RequestOptions({ headers: new Headers({ 'Accept': 'application/json', 'Access-Control-Allow-Origin': 'http://localhost:4200' }) }); let url = `http://localhost:3000/delete?photoId=${photoId}`; this.http.post(url, options).subscribe(response => { let user = response.json() console.log(user); }, err => {

Axios call api with GET become OPTIONS

て烟熏妆下的殇ゞ 提交于 2019-12-01 02:36:18
问题 I use axios for calling API (in front-end). I use the method "GET" : import axios from 'axios'; import querystring from 'querystring'; var url = "mydomain.local", token = "blablabla...blabla"; var configs = { headers: { 'Authorization': 'Bearer ' + token, 'Agency': 'demo0' } }; var testapi = axios.create({ baseURL: 'http://api.' + url }); testapi.get( '/relativeUrl', configs ).then(function (response) { console.log(response); }).catch(function (error) { console.log(error); }); I got a 405

Why do I get an OPTIONS request after making a POST request?

末鹿安然 提交于 2019-12-01 00:09:10
My front-end code: <form action="" onSubmit={this.search}> <input type="search" ref={(input) => { this.searchInput = input; }}/> <button type="submit">搜索</button> </form> // search method: const baseUrl = 'http://localhost:8000/'; // where the Express server runs search(e) { e.preventDefault(); let keyword = this.searchInput.value; if (keyword !== this.state.lastKeyword) { this.setState({ lastKeyword: keyword }); fetch(`${baseUrl}search`, { method: 'POST', // mode: 'no-cors', headers: new Headers({ 'Content-Type': 'application/json' }), // credentials: 'include', body: JSON.stringify({keyword}

No 'Access-Control-Allow-Origin' header is present on the requested resource + The response had HTTP status code 401

时光怂恿深爱的人放手 提交于 2019-11-30 13:13:18
XMLHttpRequest cannot load http://192.168.1.253:8080/ ... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://localhost:4200 ' is therefore not allowed access. The response had HTTP status code 401. Pretty common error, with a great many possible solutions that haven't worked. I understand (I think) how CORS is supposed to work, and I don't see anything wrong with my HTTP headers, but it still doesn't work From Chrome: Request URL:http://192.168.1.253:8080/... Request Method:OPTIONS Status Code:200 OK Remote Address:192.168.1.253:8080 Referrer Policy

Missing token 'access-control-allow-headers' in CORS header 'Access-Control-Allow-Headers' from CORS preflight channel

左心房为你撑大大i 提交于 2019-11-30 08:14:19
I have two VS projects : one exposing MVC5 controllers, the other being an angular client. I want the angular client to be able to query the controllers. I read numerous threads and tried the following : I added this in the server's web config: <system.webServer> <httpProtocol> <customHeaders> <clear /> <add name="Access-Control-Allow-Origin" value="*" /> </customHeaders> </httpProtocol> <system.webServer> I created and used the the following filter on the controller's action: public class AllowCrossSiteJsonAttribute : ActionFilterAttribute { public override void OnActionExecuting

Response for preflight 403 forbidden

隐身守侯 提交于 2019-11-29 16:33:36
I've been trying to make a simple iron-ajax post to the server, but it keeps failing at the preflight call. For the life of me I can't figure out what's going on, all the CORS headers seem to be correct on the server. Response headers Access-Control-Allow-Credentials:true Access-Control-Allow-Headers:Content-Type Access-Control-Allow-Methods:GET, POST, PUT, OPTIONS Access-Control-Allow-Origin:* cache-control:must-revalidate, private, no-cache, no-store, max-age=0 Connection:Keep-Alive Content-Encoding:gzip Content-Length:138 Content-Type:text/html Request headers Accept:*/* Accept-Encoding

Why do I get an OPTIONS request after making a POST request?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 15:13:09
问题 My front-end code: <form action="" onSubmit={this.search}> <input type="search" ref={(input) => { this.searchInput = input; }}/> <button type="submit">搜索</button> </form> // search method: const baseUrl = 'http://localhost:8000/'; // where the Express server runs search(e) { e.preventDefault(); let keyword = this.searchInput.value; if (keyword !== this.state.lastKeyword) { this.setState({ lastKeyword: keyword }); fetch(`${baseUrl}search`, { method: 'POST', // mode: 'no-cors', headers: new

Spring security, cors error when enable Oauth2

和自甴很熟 提交于 2019-11-29 12:31:13
I'm getting an error while querying my oauth/token endpoint. I've configured cors enable for my resource / also tried to allow all resources but nothing worked. XMLHttpRequest cannot load http://localhost:8080/oauth/token . Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://localhost:1111 ' is therefore not allowed access. The response had HTTP status code 401. vendor.js:1837 ERROR SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse (<anonymous>) at CatchSubscriber