{"action":"created","issue":{"url":"https://api.github.com/repos/expressjs/express/issues/3641","repository_url":"https://api.github.com/repos/expressjs/express","labels_url":"https://api.github.com/repos/expressjs/express/issues/3641/labels{/name}","comments_url":"https://api.github.com/repos/expressjs/express/issues/3641/comments","events_url":"https://api.github.com/repos/expressjs/express/issues/3641/events","html_url":"https://github.com/expressjs/express/issues/3641","id":320191238,"number":3641,"title":"req.xhr not work in cross origin","user":{"login":"keyiis","id":7766085,"avatar_url":"https://avatars1.githubusercontent.com/u/7766085?v=4","gravatar_id":"","url":"https://api.github.com/users/keyiis","html_url":"https://github.com/keyiis","followers_url":"https://api.github.com/users/keyiis/followers","following_url":"https://api.github.com/users/keyiis/following{/other_user}","gists_url":"https://api.github.com/users/keyiis/gists{/gist_id}","starred_url":"https://api.github.com/users/keyiis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keyiis/subscriptions","organizations_url":"https://api.github.com/users/keyiis/orgs","repos_url":"https://api.github.com/users/keyiis/repos","events_url":"https://api.github.com/users/keyiis/events{/privacy}","received_events_url":"https://api.github.com/users/keyiis/received_events","type":"User","site_admin":false},"labels":[{"id":553390819,"url":"https://api.github.com/repos/expressjs/express/labels/awaiting%20more%20info","name":"awaiting more info","color":"cc317c","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-04T08:29:19Z","updated_at":"2018-05-08T05:58:16Z","closed_at":null,"author_association":"NONE","body":"I used client post data to server by ajax,my client is desktop app,the req.xhr still false on server side\r\n**client**\r\n```\r\n $.ajax({\r\n                        type: 'POST',\r\n                        data: JSON.stringify({ user: user }),\r\n                        contentType: 'application/json',\r\n                        url: 'http://127.0.0.1:3000/client/login',\r\n                        success: response => {\r\n                            console.log(response);\r\n                            localforage.setItem('token', response.token);\r\n                        }\r\n                    });\r\n```\r\n**server**\r\n```\r\napp.use('/', (req, res, next) => {\r\n  res.setHeader('Access-Control-Allow-Origin', req.headers.origin || '*');\r\n  res.setHeader('Access-Control-Allow-Headers', \"Origin,X-Requested-With,content-type,Accept,x-access-token\");\r\n  next();\r\n}, indexRouter);\r\n```"},"comment":{"url":"https://api.github.com/repos/expressjs/express/issues/comments/387293530","html_url":"https://github.com/expressjs/express/issues/3641#issuecomment-387293530","issue_url":"https://api.github.com/repos/expressjs/express/issues/3641","id":387293530,"user":{"login":"keyiis","id":7766085,"avatar_url":"https://avatars1.githubusercontent.com/u/7766085?v=4","gravatar_id":"","url":"https://api.github.com/users/keyiis","html_url":"https://github.com/keyiis","followers_url":"https://api.github.com/users/keyiis/followers","following_url":"https://api.github.com/users/keyiis/following{/other_user}","gists_url":"https://api.github.com/users/keyiis/gists{/gist_id}","starred_url":"https://api.github.com/users/keyiis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keyiis/subscriptions","organizations_url":"https://api.github.com/users/keyiis/orgs","repos_url":"https://api.github.com/users/keyiis/repos","events_url":"https://api.github.com/users/keyiis/events{/privacy}","received_events_url":"https://api.github.com/users/keyiis/received_events","type":"User","site_admin":false},"created_at":"2018-05-08T05:58:16Z","updated_at":"2018-05-08T05:58:16Z","author_association":"NONE","body":"@dougwilson thks! i already set it.but new issuse happen\r\nhttps://github.com/expressjs/express/issues/3647"}}
{"actor":{"display_login":"keyiis"}}