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

in_http: Implement support for CORS preflight requests #2144

Merged
merged 1 commit into from Oct 10, 2018

Conversation

fujimotos
Copy link
Member

@fujimotos fujimotos commented Oct 5, 2018

This patch should fix the issue #1701.

To receive a 'application/json' request from another origin, we need
to be able to handle CORS preflight requests. Otherwise, browsers will
refuse to interact with us.

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Preflighted_requests

This patch adds support for the feature.

Signed-off-by: Fujimoto Seiji fujimoto@clear-code.com

@fujimotos
Copy link
Member Author

fujimotos commented Oct 5, 2018

I confirmed this patch works with Fluentd v1.2.6 and Firefox 60.2.1.

Test Code (JavaScript)

// Post a JSON record using XMLHttpRequest
var req = new XMLHttpRequest();
req.open('POST', 'http://fluentd.local/debug.log');
req.setRequestHeader('Content-Type', 'application/json')
req.send(JSON.stringify({'foo': 'bar'}))

Result

2018-10-05-172738_597x68_scrot

To receive a 'application/json' request from another origin, we need
to be able to handle CORS preflight requests. Otherwise, browsers will
refuse to interact with us.

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Preflighted_requests

This patch adds support for the feature.

Signed-off-by: Fujimoto Seiji <fujimoto@clear-code.com>
@repeatedly repeatedly merged commit f30865f into fluent:master Oct 10, 2018
@repeatedly
Copy link
Member

Thanks!

@fujimotos fujimotos deleted the sf/in-http-cors-preflight branch October 10, 2018 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants