Change User-Agent programatically

90 views
Skip to first unread message

David Quon

unread,
Oct 3, 2014, 3:19:53 PM10/3/14
to mobile-c...@googlegroups.com
Is it possible to change the Couchbase Lite User-Agent programmatically?  For example it would be helpful to be able to distinguish the difference between clients on different iOS versions.

Daniel Polfer

unread,
Oct 4, 2014, 1:43:41 PM10/4/14
to mobile-c...@googlegroups.com
+1 to this.  In fact, we just had the same thought about the user-agent while troubleshooting a sync issue with multiple devices behind a NAT.  That or another header that could be set on every request from the client would give some extra routing/blocking control in nginx as well. 

DanP

Jens Alfke

unread,
Oct 4, 2014, 1:57:51 PM10/4/14
to mobile-c...@googlegroups.com

> On Oct 3, 2014, at 12:19 PM, David Quon <dav...@amcoonline.net> wrote:
>
> Is it possible to change the Couchbase Lite User-Agent programmatically? For example it would be helpful to be able to distinguish the difference between clients on different iOS versions.

You mean for collecting metrics of your app's users?

The user-agent is a hardcoded string, but you can change it by editing the source code :)

—Jens

Jens Alfke

unread,
Oct 4, 2014, 8:09:20 PM10/4/14
to mobile-c...@googlegroups.com

On Oct 4, 2014, at 10:43 AM, Daniel Polfer <dan...@thepolfers.com> wrote:

+1 to this.  In fact, we just had the same thought about the user-agent while troubleshooting a sync issue with multiple devices behind a NAT.  That or another header that could be set on every request from the client would give some extra routing/blocking control in nginx as well. 

@interface CBLReplication : NSObject

/** Extra HTTP headers to send in all requests to the remote server.
    Should map strings (header names) to strings. */
@property (nonatomic, copy) NSDictionary* headers;


David Quon

unread,
Oct 6, 2014, 12:56:51 PM10/6/14
to mobile-c...@googlegroups.com
> You mean for collecting metrics of your app's users?

Not to collect metrics but mainly as a workaround for this issue:

For example we could redirect all traffic for iOS 8 CBL traffic to use TLS v1.0 and all other traffic to use TLSv1.2 based on the User-Agent.
Reply all
Reply to author
Forward
0 new messages