Skip to content

Conversation

@edsiper
Copy link
Member

@edsiper edsiper commented Nov 14, 2014

the following patches add support for two new configuration directives:

  • add_remote_ip : when is set, it stores the ip address through a REMOTE_ADDR field
  • cors_allow_origins: set a white list of domains that can do cross requests

The 'add_remote_ip' configuration parameter allows the output filter
to include the source IP address in a field called 'REMOTE_ADDR'.

It can be activated into the source as follows:

<source>
  type http
  port 9880
  add_remote_ip
</source>

Signed-off-by: Eduardo Silva <[email protected]>
…t#426).

This patch enable a partial and optional CORS support. For clients
that want to talk directly to this source, it allows to set a white
list of Cross Origin clients through the validation of the HTTP
Origin header. Usage:

 <source>
   type http
   port 9880
   cors_allow_origins http://example.com, http://www.treasuredata.com
 </source>

The new configuration key 'cors_allow_origins', allows to specify a
white list of domains, they must be separated by coma.

For those request that do not pass the CORS filter, the service will
respond with a '403 Forbidden' HTTP status code and close the connection.

Note: the CORS validation is based on the HTTP request headers, for hence
is NOT secure.

Signed-off-by: Eduardo Silva <[email protected]>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edsiper
Copy link
Member Author

edsiper commented Nov 14, 2014

thanks for the feedback. I have updated the branch with the suggested changes:

  • add_remote_ip is deprecated and add_remote_addr is used now
  • cors_allow_origins now stores a JSON array

@repeatedly
Copy link
Member

LGTM 👍
I will merge this PR after @shacharz check.

@repeatedly repeatedly self-assigned this Nov 14, 2014
repeatedly added a commit that referenced this pull request Nov 19, 2014
@repeatedly repeatedly merged commit 2f8f423 into fluent:master Nov 19, 2014
@repeatedly
Copy link
Member

I just merged this PR. If there are some feedbacks from users, we will update the code.

repeatedly added a commit that referenced this pull request Nov 24, 2014
in_http improvements
Conflicts:
	lib/fluent/plugin/in_http.rb
@sonots
Copy link
Member

sonots commented Nov 24, 2014

cherry-picked to v0.10 branch (27b25b2)

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.

3 participants