简体   繁体   中英

AJAX request over http defaulting to https

I'm trying to make an AJAX POST request from a Chrome extension to an AWS app I have running. The request itself is specified over http (as opposed to https) and I thought I had added the proper CORS headers to my AWS app (below):

app.use(function(req, res, next) {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
  next();
});

However, the POST request times out from the extension, with the simple error "connection timed out." How can I fix this?

As it works with HTTP and not over HTTPS, are you sure you opened the HTTPS port you are using in the security groups inbound rules? Inbound rules HTTP example

And also check that you have HTTPS permissions in your manifest file:

"permissions": ["https://*/*",    "http://*/*"],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM