@@ -58,7 +58,7 @@ Basic implementation of proxy client may be found at https://github.com/GoMetric
5858
5959## Usage
6060
61- Run server:
61+ * Run server (HTTP) :
6262
6363``` bash
6464statsd-http-proxy \
@@ -71,6 +71,21 @@ statsd-http-proxy \
7171 --metric-prefix=prefix.subprefix
7272```
7373
74+ * Run server (HTTPS):
75+
76+ ``` bash
77+ statsd-http-proxy \
78+ --verbose \
79+ --http-host=127.0.0.1 \
80+ --http-port=433 \
81+ --tls-cert=cert.pem \
82+ --tls-key=key.pem \
83+ --statsd-host=127.0.0.1 \
84+ --statsd-port=8125 \
85+ --jwt-secret=somesecret \
86+ --metric-prefix=prefix.subprefix
87+ ```
88+
7489Print server version and exit:
7590
7691``` bash
@@ -79,19 +94,23 @@ statsd-http-proxy --version
7994
8095Command line arguments:
8196
82- | Parameter | Description | Default value |
83- | -----------------| --------------------------------------| --------------------------------------------------------------------------------|
84- | verbose | Print debug info to stderr | Optional. Default false |
85- | http-host | Host of HTTP server | Optional. Default 127.0.0.1. To accept connections on any interface, set to "" |
86- | http-port | Port of HTTP server | Optional. Default 80 |
87- | statsd-host | Host of StatsD instance | Optional. Default 127.0.0.1 |
88- | statsd-port | Port of StatsD instance | Optional. Default 8125 |
89- | jwt-secret | JWT token secret | Optional. If not set, server accepts all connections |
90- | metric-prefix | Prefix, added to any metric name | Optional. If not set, do not add prefix |
91- | version | Print version of server and exit | Optional |
97+ | Parameter | Description | Default value |
98+ | -----------------| --------------------------------------| -----------------------------------------------------------------------------------|
99+ | verbose | Print debug info to stderr | Optional. Default false |
100+ | http-host | Host of HTTP server | Optional. Default 127.0.0.1. To accept connections on any interface, set to "" |
101+ | http-port | Port of HTTP server | Optional. Default 80 |
102+ | tls-cert | TLS certificate for the HTTPS | Optional. Default "" to use HTTP. If both tls-cert and tls-key set, HTTPS is used |
103+ | tls-key | TLS private key for the HTTPS | Optional. Default "" to use HTTP. If both tls-cert and tls-key set, HTTPS is used |
104+ | statsd-host | Host of StatsD instance | Optional. Default 127.0.0.1 |
105+ | statsd-port | Port of StatsD instance | Optional. Default 8125 |
106+ | jwt-secret | JWT token secret | Optional. If not set, server accepts all connections |
107+ | metric-prefix | Prefix, added to any metric name | Optional. If not set, do not add prefix |
108+ | version | Print version of server and exit | Optional |
92109
93110Sample code to send metric in browser with JWT token in header:
94111
112+ * HTTP:
113+
95114``` javascript
96115$ .ajax ({
97116 url: ' http://127.0.0.1:8080/count/some.key.name' ,
@@ -105,6 +124,21 @@ $.ajax({
105124});
106125```
107126
127+ * HTTPS (if self-signed certificate is used it has to be accepted!):
128+
129+ ``` javascript
130+ $ .ajax ({
131+ url: ' https://127.0.0.1:433/count/some.key.name' ,
132+ method: ' POST' ,
133+ headers: {
134+ ' X-JWT-Token' => ' some-jwt-token'
135+ },
136+ data: {
137+ value: 100500
138+ }
139+ });
140+ ```
141+
108142## Authentication
109143
110144Authentication is optional. It based on passing JWT token to server, encrypted with secret, specified in ` jwt-secret `
@@ -180,7 +214,7 @@ value=1
180214
181215| Parameter | Description | Default value |
182216| ------------| --------------------------------------| ------------------------------------|
183- | value | Integer value | Optional. Default 1 |
217+ | value | Integer value | Optional. Default 1 |
184218
185219## Response
186220
@@ -190,7 +224,7 @@ Other HTTP status codes:
190224
191225| CODE | Description |
192226| ------------------| -----------------------------------------|
193- | 400 Bad Request | Invalid parameters specified |
227+ | 400 Bad Request | Invalid parameters specified |
194228| 401 Unauthorized | Token not sent |
195229| 403 Forbidden | Token invalid/expired |
196230| 404 Not found | Invalid url requested |
0 commit comments