| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # Client::Connection::IP() is the PROXY protocol source on a port with pp-clnt, the TCP peer otherwise. | |
| meta: | |
| version: '1.0' | |
| urtest: | |
| description: Cripts' client IP follows the core's client address under PROXY protocol | |
| requires: | |
| ats_features: [TS_HAS_CRIPTS] | |
| server: {name: cripts-client-ip-origin} | |
| client: | |
| name: cripts-client-ip-client | |
| process_config: | |
| http_ports: ["{ATS_PROXY_PROTOCOL_PORT}"] | |
| ats: | |
| name: cripts-client-ip-ts | |
| process_config: | |
| enable_cache: false | |
| enable_cripts: true | |
| enable_proxy_protocol: true | |
| startup_timeout: 60 | |
| records_config: | |
| proxy.config.plugin.dynamic_reload_mode: 1 | |
| proxy.config.http.proxy_protocol_allowlist: 127.0.0.1 | |
| proxy.config.log.max_secs_per_buffer: 1 | |
| copy_to_config_dir: | |
| - {source: files/client_ip.cript, destination: client_ip.cript} | |
| remap_config: | |
| - map / http://127.0.0.1:{SERVER_HTTP_PORT}/ @plugin=client_ip.cript | |
| logging_yaml: | |
| logging: | |
| formats: | |
| - name: access | |
| format: "%<chi> %<{X-Cripts-Client-IP}psh> %<{X-Cripts-Close-IP}psh>" | |
| logs: | |
| - filename: access | |
| format: access | |
| variants: | |
| - name: peer-address | |
| ats: | |
| file_checks: | |
| - path: "{LOG_DIR}/access.log" | |
| line_count_min: 2 | |
| matches: | |
| - {expression: '^127\.0\.0\.1 127\.0\.0\.1 127\.0\.0\.1$', min: 2, max: 2} | |
| - name: proxy-source-address | |
| ats: | |
| process_config: | |
| enable_proxy_protocol_cp_src: true | |
| file_checks: | |
| - path: "{LOG_DIR}/access.log" | |
| line_count_min: 2 | |
| matches: | |
| - {expression: '^127\.0\.0\.1 127\.0\.0\.1 127\.0\.0\.1$', min: 1, max: 1} | |
| - {expression: '^198\.51\.100\.1 198\.51\.100\.1 198\.51\.100\.1$', min: 1, max: 1} | |
| sessions: | |
| - protocol: | |
| stack: http | |
| transactions: | |
| - client-request: | |
| method: GET | |
| version: '1.1' | |
| url: /no-proxy-header | |
| headers: | |
| fields: | |
| - [Host, www.example.com] | |
| - [uuid, no-proxy-header] | |
| server-response: | |
| status: 200 | |
| reason: OK | |
| headers: | |
| fields: | |
| - [Content-Length, 0] | |
| proxy-response: | |
| status: 200 | |
| - protocol: | |
| stack: http | |
| proxy-protocol: | |
| version: 1 | |
| src-addr: 198.51.100.1:51137 | |
| dst-addr: 198.51.100.2:80 | |
| transactions: | |
| - client-request: | |
| method: GET | |
| version: '1.1' | |
| url: /proxy-header | |
| headers: | |
| fields: | |
| - [Host, www.example.com] | |
| - [uuid, proxy-header] | |
| server-response: | |
| status: 200 | |
| reason: OK | |
| headers: | |
| fields: | |
| - [Content-Length, 0] | |
| proxy-response: | |
| status: 200 |