fix Express CORS support for 127.0.0.1 (closes #92)

Co-authored-by: qiaodong <qiaodong6733@dingtalk.com>
pull/95/head
tigersniffs 4 years ago committed by GitHub
parent 40100377f8
commit ed7207cf22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,7 +27,7 @@ const db = {
const app = express(); const app = express();
app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(cors({ origin: /http:\/\/localhost/ })); app.use(cors({ origin: /http:\/\/(127(\.\d){3}|localhost)/}));
app.options('*', cors()); app.options('*', cors());
// *************************************************************************** // ***************************************************************************

Loading…
Cancel
Save