Fix unstored cookie on localhost

Fix #1562