# CrossDomains

대부분의 브라우저와 플레이어는 현재 실행 중인 도메인에서 다른 도메인의 리소스에 접근하는 것을 금지합니다. 교차 출처 리소스 공유(CORS) 또는 크로스도메인(CrossDomain)을 통해 이러한 상황을 제어할 수 있습니다. `<CrossDomains>` 엘리먼트로 CORS 및 크로스도메인을 설정할 수 있습니다.

크로스도메인 설정은 HTTP 기반 API, HLS, LLHLS 및 썸네일 퍼블리셔, 그리고 WebRTC 프로바이더(WHIP)에서 사용할 수 있습니다.

```xml
<CrossDomains>
    <Url>*</Url>
    <Url>*.airensoft.com</Url>
    <Url>http://*.ovenplayer.com</Url>
    <Url>https://demo.ovenplayer.com</Url>
    <Header>
        <Key>Access-Control-Expose-Headers</Key>
        <Value>Date, Server, Content-Type, Content-Length</Value>
    </Header>
    <Header>
        <Key>custom-header</Key>
        <Value>airensoft</Value>
    </Header>
</CrossDomains>
```

위와 같이 `<Url>` 엘리먼트를 사용하여 설정할 수 있으며, 다음 값을 사용할 수 있습니다:

<table><thead><tr><th width="290">Url Value</th><th>Description</th></tr></thead><tbody><tr><td><code>*</code></td><td>모든 도메인에서의 요청을 허용합니다.</td></tr><tr><td>domain</td><td>지정된 도메인에서의 HTTP 및 HTTPS 요청을 모두 허용합니다.</td></tr><tr><td>http://domain</td><td>지정된 도메인에서의 HTTP 요청을 허용합니다.</td></tr><tr><td>https://domain</td><td>지정된 도메인에서의 HTTPS 요청을 허용합니다.</td></tr></tbody></table>

`<CrossDomains>`를 통해 사용자 지정 HTTP 헤더로 응답할 수 있습니다. 위의 예시처럼 여러 개의 `<Header>/<Key>` 및 `<Header>/<Value>`를 추가하여 사용할 수 있습니다.

## Default(Global) CORS Settings

모든 애플리케이션이 동일한 CORS 정책을 공유하는 경우 `<Server><Defaults><CrossDomains>` 아래에 CORS를 구성하여 글로벌하게 적용할 수 있습니다. 이 기본 CORS 설정은 `400 Bad Request` 응답이나 존재하지 않는 애플리케이션에 대한 요청과 같은 잘못된 요청에도 적용됩니다.

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Server version="8">
    <Name>OvenMediaEngine</Name>
    ... omitted ...

    <!-- Default Settings for all Virtual Hosts -->
    <Defaults>
        <CrossDomains>
            <Url>*.ovenplayer.com</Url>
        </CrossDomains>
    </Defaults>

    <VirtualHosts>
        <VirtualHost>
            <Name>default</Name>
    ... omitted ...
```

{% hint style="warning" %}
버전 0.19.0까지는 기본 CORS 설정이 VirtualHost별로 지원되었으며 `<Server><VirtualHosts><VirtualHost><CrossDomain>`에서 구성해야 했습니다. 그러나 이 방법은 이제 사용되지 않으며(deprecated) 더 이상 적용되지 않습니다. 구성은 `<Server><Defaults><CrossDomain>` 아래로 통합되었습니다.
{% endhint %}

## Application-Specific CORS Settings

특정 애플리케이션에 다른 CORS 정책이 필요한 경우 해당 애플리케이션에 CORS 구성을 추가할 수 있습니다. 이 경우 애플리케이션별 CORS 설정이 우선 적용됩니다. 예를 들어, 다음과 같이 현재의 WebRTC 프로바이더(WHIP), LLHLS, HLS 및 썸네일 퍼블리셔에 대한 CORS를 구성할 수 있습니다:

```xml
<VirtualHost>
    <Name>default</Name>
    ... omitted ...
    <Applications>
        <Application>
            <Name>app</Name>
            <Type>live</Type>
            ... omitted ...
            <Providers>
                <WebRTC>
                    <CrossDomains>
                        <Url>*</Url>
                    </CrossDomains>
                </WebRTC>
            </Providers>
            <Publishers>
                <LLHLS>
                    <ChunkDuration>0.5</ChunkDuration>
                    <PartHoldBack>1.5</PartHoldBack>
                    <SegmentDuration>6</SegmentDuration>
                    <SegmentCount>10</SegmentCount>
                    <CrossDomains>
                        <Url>*</Url>
                    </CrossDomains>
                </LLHLS>
                <HLS>
                    <SegmentCount>4</SegmentCount>
                    <SegmentDuration>4</SegmentDuration>
                    <CrossDomains>
                        <Url>*</Url>
                    </CrossDomains>
                </HLS>
                <Thumbnail>
                    <CrossDomains>
                        <Url>*</Url>
                    </CrossDomains>
                </Thumbnail>
            </Publishers>
        </Application>
    </Applications>
</VirtualHost>

```


---

# 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/operations-and-monitoring/crossdomains.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.
