Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
1
  • Loading branch information
javaliv2 committed Nov 30, 2020
1 parent e78007b commit 56b8b14
Showing 1 changed file with 94 additions and 91 deletions.
185 changes: 94 additions & 91 deletions admin/adv_vhost.rst
Original file line number Diff line number Diff line change
Expand Up @@ -278,102 +278,12 @@ Facade 가상호스트



.. _adv-vhost-sub-path:

Sub-Path 지정
====================================

한 가상호스트에서 경로에 따라 다른 가상호스트가 처리하도록 설정할 수 있다.

.. figure:: img/adv_vhost_subpath.png
:align: center

통계/로그는 요청을 최종처리한 각각의 가상호스트에 기록된다.


::

# vhosts.xml - <Vhosts>

<Vhost Name="sports.com">
<Sub Status="Active">
<Path Vhost="baseball.com">/baseball/<Path>
<Path Vhost="football.com">/football/<Path>
<Path Vhost="photo.com">/*.jpg<Path>
</Sub>
</Vhost>

<Vhost Name="baseball.com" />
<Vhost Name="football.com" />
<Vhost Name="photo.com" />

- ``<Sub>`` 경로나 패턴이 일치하면 해당 요청을 다른 가상호스트로 보낸다.
일치하지 않는 경우만 현재 가상호스트가 처리한다.

- ``Status (기본: Active)`` Inactive인 경우 무시한다.

- ``<Path>`` 클라이언트가 요청한 URI와 경로가 일치하면 ``Vhost`` 로 해당 요청을 보낸다.
값은 경로 또는 패턴만 가능하다. ::

<Path Vhost="baseball.com">baseball<Path>
<Path Vhost="photo.com">*.jpg<Path>

위와 같이 입력해도 각각 /baseball/과 /*.jpg로 인식된다.
예를 들어 클라이언트가 다음과 같이 요청했다면 해당 요청은 가상호스트 football.com이 처리한다. ::

GET /football/rank.html HTTP/1.1
Host: sports.com


.. _adv-vhost-redirection-trace:

Redirect 추적
====================================

원본서버에서 Redirect계열(301, 302, 303, 307)로 응답하는 경우 ``Location`` 헤더를 추적하여 콘텐츠를 요청한다.

.. figure:: img/conf_redirectiontrace.png
:align: center

클라이언트는 Redirect여부를 모른다.

::

# server.xml - <Server><VHostDefault><OriginOptions>
# vhosts.xml - <Vhosts><Vhost><OriginOptions>

<RedirectionTrace>OFF</RedirectionTrace>

- ``<RedirectionTrace>``

- ``OFF (기본)`` 3xx 응답으로 저장된다.

- ``ON`` Location헤더에 명시된 주소에서 콘텐츠를 다운로드 한다.
형식에 맞지 않거나 Location헤더가 없는 경우에는 동작하지 않는다.
무한히 Redirect되는 경우를 방지하기 위하여 1회만 추적한다.


특정 URL 패턴에 대해서만 동작시킬 수 있다. ::

# server.xml - <Server><VHostDefault><OriginOptions>
# vhosts.xml - <Vhosts><Vhost><OriginOptions>

<RedirectionTrace ResCode="302,307">ON
<URL>*.ts</URL>
<URL>*.mp4</URL>
</RedirectionTrace>


``<RedirectionTrace>`` 하위에 ``<URL>`` 들을 열거하면 ``Location`` 헤더 값의 특정 패턴에 대해서만 추적한다.



고급 기능 ``powered by M2``
====================================

이외에 실서비스에서 즉시 활용 가능한 다양한 `인프라 구성 패턴 <https://csp-kr.readthedocs.io/ko/latest/patterns/pattern_infra.html>`_ 이 존재한다.
`인프라 구성 패턴 <https://csp-kr.readthedocs.io/ko/latest/patterns/pattern_infra.html>`_ 은 `M2 파이프라인 플랫폼 <https://m2-kr-next.readthedocs.io/>`_ 의 `이미지 엔진 <https://m2-kr.readthedocs.io/ko/latest/guide/image.html>`_ 에 기반하여 구현된다.
`인프라 구성 패턴 <https://csp-kr.readthedocs.io/ko/latest/patterns/pattern_infra.html>`_ 은 `M2 파이프라인 플랫폼 <https://m2-kr-next.readthedocs.io/>`_ 의 `위치 투명성 <https://m2-kr.readthedocs.io/ko/latest/guide/caching.html#engine-caching-transparency>`_ 에 기반하여 구현된다.


.. _adv-vhost-link:
Expand Down Expand Up @@ -481,3 +391,96 @@ Redirect 추적
* 대상 가상호스트가 존재하지 않는 경우 (foo.com -> ?)
* 자기 자신을 대상 가상호스트로 지정한 경우 (foo.com -> foo.com)
* 재귀링크(Recursive Link)가 발생한 경우 (foo.com -> bar.com -> foo.com)



.. _adv-vhost-redirection-trace:

Redirect 추적
-------------------------------------------

원본서버에서 Redirect계열(301, 302, 303, 307)로 응답하는 경우 ``Location`` 헤더를 추적하여 콘텐츠를 요청한다.

.. figure:: img/conf_redirectiontrace.png
:align: center

클라이언트는 Redirect여부를 모른다.

::

# server.xml - <Server><VHostDefault><OriginOptions>
# vhosts.xml - <Vhosts><Vhost><OriginOptions>

<RedirectionTrace>OFF</RedirectionTrace>

- ``<RedirectionTrace>``

- ``OFF (기본)`` 3xx 응답으로 저장된다.

- ``ON`` Location헤더에 명시된 주소에서 콘텐츠를 다운로드 한다.
형식에 맞지 않거나 Location헤더가 없는 경우에는 동작하지 않는다.
무한히 Redirect되는 경우를 방지하기 위하여 1회만 추적한다.


특정 URL 패턴에 대해서만 동작시킬 수 있다. ::

# server.xml - <Server><VHostDefault><OriginOptions>
# vhosts.xml - <Vhosts><Vhost><OriginOptions>

<RedirectionTrace ResCode="302,307">ON
<URL>*.ts</URL>
<URL>*.mp4</URL>
</RedirectionTrace>


``<RedirectionTrace>`` 하위에 ``<URL>`` 들을 열거하면 ``Location`` 헤더 값의 특정 패턴에 대해서만 추적한다.


.. _adv-vhost-sub-path:

Sub-Path 지정
-------------------------------------------

한 가상호스트에서 경로에 따라 다른 가상호스트가 처리하도록 설정할 수 있다.

.. figure:: img/adv_vhost_subpath.png
:align: center

통계/로그는 요청을 최종처리한 각각의 가상호스트에 기록된다.


::

# vhosts.xml - <Vhosts>

<Vhost Name="sports.com">
<Sub Status="Active">
<Path Vhost="baseball.com">/baseball/<Path>
<Path Vhost="football.com">/football/<Path>
<Path Vhost="photo.com">/*.jpg<Path>
</Sub>
</Vhost>

<Vhost Name="baseball.com" />
<Vhost Name="football.com" />
<Vhost Name="photo.com" />

- ``<Sub>`` 경로나 패턴이 일치하면 해당 요청을 다른 가상호스트로 보낸다.
일치하지 않는 경우만 현재 가상호스트가 처리한다.

- ``Status (기본: Active)`` Inactive인 경우 무시한다.

- ``<Path>`` 클라이언트가 요청한 URI와 경로가 일치하면 ``Vhost`` 로 해당 요청을 보낸다.
값은 경로 또는 패턴만 가능하다. ::

<Path Vhost="baseball.com">baseball<Path>
<Path Vhost="photo.com">*.jpg<Path>

위와 같이 입력해도 각각 /baseball/과 /*.jpg로 인식된다.
예를 들어 클라이언트가 다음과 같이 요청했다면 해당 요청은 가상호스트 football.com이 처리한다. ::

GET /football/rank.html HTTP/1.1
Host: sports.com


0 comments on commit 56b8b14

Please sign in to comment.