Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CORS #43

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"babel-register": "^6.14.0",
"body-parser": "^1.15.2",
"bunyan": "^1.8.1",
"cors": "^2.8.4",
"express": "^4.14.0",
"fs-extra": "^5.0.0",
"joi": "^13.1.2",
Expand Down
2 changes: 2 additions & 0 deletions src/elastalert_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ProcessController from './controllers/process';
import RulesController from './controllers/rules';
import TemplatesController from './controllers/templates';
import TestController from './controllers/test';
import cors from 'cors';

let logger = new Logger('Server');

Expand Down Expand Up @@ -58,6 +59,7 @@ export default class ElastalertServer {
// Start the server when the config is loaded
config.ready(function () {
try {
self._express.use(cors());
self._express.use(bodyParser.json());
self._express.use(bodyParser.urlencoded({ extended: true }));
self._setupRouter();
Expand Down