# Proxy Protocol

이 기능을 통해 OvenMediaEngine은 The PROXY protocol을 통해 입력되는 스트림을 처리할 수 있습니다. 이 기능을 활성화 하기 위해서는 다음과 같이 `Server.xml`에서 `<HAProxyProtocol>`을 활성화 하십시오.

```xml
<Server>
...
  <Modules>
    <!-- Cloudflare를 위한 HAProxyProtocol 기능 활성화, 기본값: false -->
    <HAProxyProtocol>
      <Enable>true</Enable>
    </HAProxyProtocol>
... 
```

## Access Control에서 HAProxy Protocol 사용하기

당신은 HAProxy Protocol 위에서 전달되는 Client Address를 Access Control에서 사용할 수 있습니다.

### SignedPolicy

`SignedPoicy`에 `real_ip` 정책이 설정되면 당신은 HAProxy Protocol을 통해 전달되는 Client Address를 검증할 수 있습니다. `allow_ip`는 직접 연결된 클라이언트의 IP이므로, 접속된 IP가 허용된 프록시 서버의 IP인지 먼저 검사하면 보안성을 더 강화할 수 있습니다.

```json
{
    "url_activate":1399711581,                                    
    "url_expire":1399721581,                                    
    "stream_expire":1399821581,                                    
    "allow_ip":"192.168.100.5/32",
    "real_ip":"111.111.111.111/32"
}
```

`HAProxyProtocol`이 활성화 될 경우, `SignedPolicy`는 The Proxy protocol 을 통해 전달되는 Client Address를 `real_ip`와 비교하여 검증합니다.

{% hint style="info" %}
세부 가이드: <https://docs.ovenmediaengine.com/dev/access-control/signedpolicy>
{% endhint %}

### Admission Webhooks

`AdmissionWebhooks`의 `real_ip`에 HAProxy Protocol을 통해 전달되는 Client Address가 Control Server에 전달됩니다.

`address`에는 기존과 동일하게 직접 연결된 클라이언트의 IP가 전달되므로, 그 IP가 허용된 프록시 서버의 IP인지 먼저 검사하면 보안성을 더 강화할 수 있습니다.

```json
POST /configured/target/url/ HTTP/1.1
Content-Length: 325
Content-Type: application/json
Accept: application/json
X-OME-Signature: f871jd991jj1929jsjd91pqa0amm1
{
  "client": 
  {
    "address": "211.233.58.86",
    "port": 29291,
    "real_ip": "192.0.2.43",
    "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
  },
  "request":
  {
    "direction": "incoming | outgoing",
    "protocol": "webrtc | rtmp | srt | llhls | thumbnail",
    "status": "opening | closing",
    "url": "scheme://host[:port]/app/stream/file?query=value&query2=value2",
    "new_url": "scheme://host[:port]/app/new_stream/file?query=value&query2=value2",
    "time": "2021-05-12T13:45:00.000Z"
  }
}
```

`HAProxyProtocol`이 활성화 될 경우, `AdmissionWebhooks`는 `real_ip`에 기존의 `X-REAL-IP`나 `X-FORWARDED-FOR` 헤더보다, The Proxy protocol을 통해 전달되는 Client Address를 가장 높은 우선순위로 Setting합니다.

{% hint style="info" %}
세부 가이드: <https://docs.ovenmediaengine.com/dev/access-control/admission-webhooks>
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ovenmediaengine-enterprise.gitbook.io/guide/ko-kr/features/workflow-integration-and-external-system-connectivity/proxy-protocol.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
