我有一个适用于http(localhost)和https(heroku)的Chrome应用程序正常工作,但firefox没有将cookie设置为https(heroku)。它在http(localhost)(Express Server)
上工作正常app.js
app.use(session({
secret: 'secretKey123',
resave: false,
saveUninitialized: false,
store: new MongoStore({ mongooseConnection: mongoose.connection }),
cookie: { maxAge: 180 * 60 * 1000 }}));
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();});
ajax电话:
$.ajax({
url: 'http://localhost:3000/remove/' + id,
contentType: 'application/json; charset=UTF-8',
type: 'GET',
success: function(data) {
var dataOj = $.parseJSON(data);
$('#total-price').html("Total: Rs. " + dataOj.total);
$('.cart-qty').html(dataOj.qty);
$('#' + id).remove();
if ($('.cart-items tr').length === 1) {
$('.cart-panel').html('<h2>Your Cart is Empty.</h2>');
}