Skip to content

Added default_headers attribute to RiakHttpConnection - #295

Closed
flashingpumpkin wants to merge 1 commit into
basho:masterfrom
flashingpumpkin:master
Closed

Added default_headers attribute to RiakHttpConnection#295
flashingpumpkin wants to merge 1 commit into
basho:masterfrom
flashingpumpkin:master

Conversation

@flashingpumpkin

Copy link
Copy Markdown

Because basho/riak#355 hasn't landed yet I've added this.

It allows one to set default HTTP headers which are used on each request, e.g. Authorization headers. This is useful when using Riak together with a load balancer or proxy with basic auth.

Usage:

import riak
headers = {'Authorization': 'Basic {}'.format('riak:example'.encode('base64')).strip()}
http = riak.RiakClient(http_port=8080, protocol='http', transport_options={'default_headers': headers})
https = riak.RiakClient(http_port=8088, protocol='https', transport_options={'default_headers': headers})

Allows one to set default HTTP headers which are used on each request,
e.g. Authorization headers.
@seancribbs

Copy link
Copy Markdown

I would normally accept this but we will be adding auth stuff for the Riak 2.0 series (which also requires TLS if you have auth enabled). Luckily it will work the same with an authenticating proxy LB as if connecting directly to Riak, as long as the LB also uses TLS.

@seancribbs seancribbs closed this Jan 13, 2014
@flashingpumpkin

Copy link
Copy Markdown
Author

Quick follow up question if this is in the making or not? Just asking to know if I can drop my fork with default headers or not. I can't seem to find anything in the client docs.

@hazen

hazen commented Jul 18, 2014

Copy link
Copy Markdown

@flashingpumpkin, yes, Riak 2.0 will have security/authentication when it is released in the near future. You can look at the beta documentation at the moment to learn more: http://docs.basho.com/riak/2.0.0beta1/ops/running/authz/ and http://docs.basho.com/riak/2.0.0beta1/ops/running/security-sources/. Client documentation will be forthcoming. Here is someone's experience with using Python and security with the 2.0 beta releases, too: http://stackoverflow.com/questions/23955110/how-to-get-riak-2-0-security-working-with-riak-python-client

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