<commit_before>---
title: Monitoring Proxy Server
keywords: proxy, http, header
last_updated: Feb 1, 2018
sidebar: mydoc_sidebar
permalink: proxyhttpheader.html
disqus: false
---

# Proxy monitoring using HTTP headers
It is used to know the elapsed time between proxy and WAS.

![overview](images/proxy-http-header-overview.png)

## Pinpoint Configuration

pinpoint.config
~~~
profiler.proxy.http.header.enable=true
~~~

## Proxy Configuration
### Apache HTTP Server
* http://httpd.apache.org/docs/2.4/en/mod/mod_headers.html

Add HTTP header.
~~~
Pinpoint-ProxyApache: t=991424704447256 D=3775428 i=51 b=49
~~~

e.g.

httpd.conf
~~~
<IfModule mod_jk.c>
...
RequestHeader set Pinpoint-ProxyApache "%t %D %i %b"
...
</IfModule>
~~~
**%t is required value.**

### Nginx
* http://nginx.org/en/docs/http/ngx_http_core_module.html
* http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_set_header

Add HTTP header.
~~~
Pinpoint-ProxyNginx: t=1504248328.423 D=0.123
~~~

e.g.

nginx.conf
~~~
...
  server {
        listen       9080;
        server_name  localhost;

        location / {
            ...
            set $pinpoint_proxy_header "t=$msec D=$request_time";
            proxy_set_header Pinpoint-ProxyNginx $pinpoint_proxy_header;
        }
  }
...
~~~
or
~~~
http {
...

    proxy_set_header Pinpoint-ProxyNginx t=$msec;

...
}
~~~
**t=$msec is required value.**

### App
Milliseconds since epoch and app information.

Add HTTP header.
~~~
Pinpoint-ProxyApp: t=1502861340 app=foo-bar<commit_msg>Clarify milliseconds is a 13 digit number<commit_after>---
title: Monitoring Proxy Server
keywords: proxy, http, header
last_updated: Feb 1, 2018
sidebar: mydoc_sidebar
permalink: proxyhttpheader.html
disqus: false
---

# Proxy monitoring using HTTP headers
It is used to know the elapsed time between proxy and WAS.

![overview](images/proxy-http-header-overview.png)

## Pinpoint Configuration

pinpoint.config
~~~
profiler.proxy.http.header.enable=true
~~~

## Proxy Configuration
### Apache HTTP Server
* http://httpd.apache.org/docs/2.4/en/mod/mod_headers.html

Add HTTP header.
~~~
Pinpoint-ProxyApache: t=991424704447256 D=3775428 i=51 b=49
~~~

e.g.

httpd.conf
~~~
<IfModule mod_jk.c>
...
RequestHeader set Pinpoint-ProxyApache "%t %D %i %b"
...
</IfModule>
~~~
**%t is required value.**

### Nginx
* http://nginx.org/en/docs/http/ngx_http_core_module.html
* http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_set_header

Add HTTP header.
~~~
Pinpoint-ProxyNginx: t=1504248328.423 D=0.123
~~~

e.g.

nginx.conf
~~~
...
  server {
        listen       9080;
        server_name  localhost;

        location / {
            ...
            set $pinpoint_proxy_header "t=$msec D=$request_time";
            proxy_set_header Pinpoint-ProxyNginx $pinpoint_proxy_header;
        }
  }
...
~~~
or
~~~
http {
...

    proxy_set_header Pinpoint-ProxyNginx t=$msec;

...
}
~~~
**t=$msec is required value.**

### App
Milliseconds since epoch (13 digits) and app information.

Add HTTP header.
~~~
Pinpoint-ProxyApp: t=1594316309407 app=foo-bar
{'fraction_non_alphanumeric': 0.1447668731659602, 'fraction_numerical': 0.04401695467883926, 'mean_word_length': 3.414388489208633, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4004254', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1083, 'n_words': 241}