<-
Apache > HTTP Server > Documentation > Version 2.4

�������� (Content Negotiation)

������ ���:  en  |  fr  |  ja  |  ko  |  tr 

�� ������ �ֽ��� ������ �ƴմϴ�. �ֱٿ� ����� ������ ���� ������ �����ϼ���.

����ġ�� HTTP/1.1 �Ծ࿡ ����� ��������(content negotiation)�� �����Ѵ�. ���������� media type, ���, ��������, ���ڵ� � ���� �������� ������ ��ȣ���� ���� �ڿ��� ���� ������ ǥ���� �����Ѵ�. �� �ҿ����� ���� ������ ������ �������� ��û�� ���������� ó���ϴ� ��ɵ� �ִ�.

�⺻������ �����ϵǴ� mod_negotiation ����� �������� ����� �����Ѵ�.

Support Apache!

����

top

�������� ����

�ڿ��� ���� �ٸ� ǥ���� ���� �� �ִ�. ���� ���, �ٸ� �� �ٸ� media type Ȥ�� �� ��ΰ� �ٸ� ǥ������ ���� �� �ִ�. ���� ������ ǥ���� �����ϴ� �Ѱ��� ����� ����ڿ��� ��� �������� �����ְ� �����ϰ� �ϴ� ���̴�. �׷��� ������ �ڵ����� �����ϴ� �͵� �����ϴ�. �̴� �������� ��û�� �Ϻη� �׵��� ��ȣ�ϴ� ǥ���� ���� ������ �����⶧���� �����ϴ�. ���� ���, �������� �������� �Ҿ��, �׷��� ���ٸ� ����� ������ �����ʹٰ� �˷��� �� �ִ�. �������� ��û�� ����� �׵��� ��ȣ�� ��Ÿ����. ���� �Ҿ�ε� ǥ������ ��û�Ѵٸ� �������� ������ ���� ������.

Accept-Language: fr

�̷� ��ȣ�� ǥ���� ���� �ٸ� ��쿡�� �����ȴ�.

������ �� ������ ��û�� ���� �������� �Ҿ�� ��� ���� �� ������, �Ҿ �� ��ȣ�ϰ�, ���� media type�� ���� �� ������, �Ϲ� �ؽ�Ʈ ���ٴ� HTML, �ٸ� media type ���ٴ� GIF�� JPEG�� ��ȣ�Ѵٰ� �˷��ش�.

Accept-Language: fr; q=1.0, en; q=0.5
Accept: text/html; q=1.0, text/*; q=0.8, image/gif; q=0.6, image/jpeg; q=0.6, image/*; q=0.5, */*; q=0.1

����ġ�� HTTP/1.1 �Ծ࿡ ���ǵ� '���� �ֵ�(server driven)' ���������� �����Ѵ�. ����ġ�� Accept, Accept-Language, Accept-Charset, Accept-Encoding ��û ����� ��� �����Ѵ�. ��, ����ġ�� RFC 2295�� RFC 2296�� ���ǵ� �������� ���������� '�ڿ�������(transparent)' ��û ����� �����Ѵ�. �׷��� �� RFC�� ���ǵ� '��� ����(feature negotiation)'�� �������� �ʴ´�.

�ڿ�(resource)�� (RFC 2396) URI�� �����ϴ� �������� �����. ����ġ�� ���� �������� �ڿ��� ǥ��(representations)�� �����Ѵ�. ǥ���� ������ media type, ��������, ���ڵ� ���� ���� ����Ʈ��� ���ִ�. �ڿ��� ���� ǥ���� (���δ� ���� ���� �ִ�) �����ȴ�. �ڿ��� ���� ǥ���� �ִٸ� �ڿ��� ���󰡴��ϴٰ�(negotiable) �θ���, �̶� �� ǥ���� ����(variant)�̶�� �Ѵ�. ���󰡴��� �ڿ��� ���� ������ ������ ����(dimension)��� �Ѵ�.

top

����ġ�� ����

�ڿ��� �����ϱ����� ������ �� ������ ���� ������ �ʿ��ϴ�. ���� �ΰ��� ����� �ϳ��� ������ ��´�:

type-map ���� ����ϱ�

type map�� type-map�̶� �ڵ鷯�� ����� (Ȥ�� ���� ����ġ ������ ȣȯ�� ���� MIME type�� application/x-type-map��) ������. �� ����� ����Ϸ��� �������� type-map �ڵ鷯�� ���� ���� Ȯ���ڸ� �����ؾ� �Ѵ�. ���� �������Ͽ� ������ ���� �����ϴ� ���� ����.

AddHandler type-map .var

Type map ������ �ش��ϴ� �ڿ��� �̸��� ���ƾ� �ϰ�, �� ������ ���� �׸��� �־�� �Ѵ�. �׸��� ���� HTTP���� ��� �ٷ� �����ȴ�. ������ ���� ������ �׸���� ���ٷ� �����Ѵ�. �׸�ȿ��� ������ ����� �� ����. (�̷��� �� �ʿ䰡 ����, �־ ����������) ���� �׸��� �������� ������ �ִ� �������� map ������ �����ϴ� ���� �����̴�. ������ map ���� ����. �� ������ �̸��� foo.var��, foo��� �ڿ��� �����Ѵ�.

URI: foo

URI: foo.en.html
Content-type: text/html
Content-language: en

URI: foo.fr.de.html
Content-type: text/html;charset=iso-8859-2
Content-language: fr, de

typemap ������ ���ϸ� Ȯ���� ����, ������ Multiviews�� ����Ͽ���, �켱���� ������ �����϶�. ������ ���� �ٸ� ǰ���� �����ٸ�, ������ ���� (JPEG, GIF, ASCII-art�� �ش��ϴ�) media type�� "qs" �Ķ���ͷ� ǰ��(source quality)�� ǥ���� �� �ִ�:

URI: foo

URI: foo.jpeg
Content-type: image/jpeg; qs=0.8

URI: foo.gif
Content-type: image/gif; qs=0.5

URI: foo.txt
Content-type: text/plain; qs=0.01

qs ���� 0.000���� 1.000 ���̴�. qs ���� 0.000�� ������ ���� ���õ��� ������ �����϶�. 'qs' ���� ���� ������ 1.0���� ��޵ȴ�. qs ���� Ŭ���̾�Ʈ�� �ɷ°��� ������� �ٸ� ������� ���Ͽ� �� ������ ������� 'ǰ��'�� ��Ÿ����. ���� ���, ������ ��Ÿ������ ��� JPEG ������ ASCII ���Ϻ��ٴ� �׻� ���� ǰ���� ������. �׷��� �ڿ��� ���� ASCII art���ٸ� ASCII ǥ���� JPEG ǥ������ �� ���� ǰ���� ���� �� �ִ�. �׷��Ƿ� � ������ qs ���� ǥ���Ϸ��� �ڿ��� ������ ���� �ٸ���.

�����ϴ� ��� ��� ����� mod_negotation typemap ������ �����϶�.

Multiviews

MultiViews�� ���丮�� �ɼ��̹Ƿ�, apache2.conf�� <Directory>, <Location>, <Files> ���� Ȥ�� (AllowOverride�� ������ �����Ǿ��ٸ�) .htaccess ������ Options ���þ ������ �� �ִ�. Options All�� MultiViews�� �������������� �����϶�. ���� ���� ����� �Ѵ�.

MultiViews�� ����ϸ� ������ ���� ���� �Ͼ��: ������ /some/dir/foo�� ���� ��û�� �ް� /some/dir/foo�� MultiViews�� �����ϸ� /some/dir/foo�� �������� ���� ���, ������ ���丮���� �̸��� foo.*�� ���ϵ��� ��� �����ϴ� ������ type map�� �����. Ŭ���̾�Ʈ�� ��û�� media type�� content-encoding�� ������ ���߿� ���� ������ ���� �����Ѵ�.

MultiViews�� ������ ���丮�� �����Ҷ� ������ ã�� DirectoryIndex ���þ�� ����ȴ�. ���������� ������ ���ٸ�,

DirectoryIndex index

index.html�� index.html3�� ��� �ִٸ� ������ �̵� �߿� �ϳ��� �����Ѵ�. �� ��� ���� index.cgi�� �ִٸ�, ������ �װ��� �����Ѵ�.

���丮�� ������ ������ �ϳ��� Charset, Content-Type, Language, Encoding�� �Ǵ��ϴ� mod_mime�� �𸣴� Ȯ���ڸ� �����ٸ�, ����� MultiViewsMatch ���þ� ������ �޷Ǵ�. �� ���þ�� �ڵ鷯, ����, �ٸ� Ȯ�������� MultiViews ���� �������� ���θ� �����Ѵ�.

top

������

����ġ�� type-map �����̳� ���丮�� �ִ� ���ϸ���� �־��� �ڿ��� ���� ���� ����� ��ԵǸ� '������' ������ �����ϱ����� �� ����� �ϳ��� ����Ѵ�. ����ġ �������� ����� ����ϱ����� ��Ȯ�� ������ ��� �Ͼ���� �ڼ��� �� �ʿ�� ����. �׷��� �ñ��� ����� ���� �� ����� �����Ѵ�.

�ΰ��� �������� �ִ�:

  1. ����ġ �˰������� ����Ͽ� ������ �ֵ��ϴ� ������ �Ϲ����� ��쿡 ����Ѵ�. ����ġ �˰������� �Ʒ��� �ڼ��� �����Ѵ�. �� �˰������� ����ϸ� ����ġ�� �� ���� ����� ������� ���� Ư�� ������ ǰ�����(quality factor)�� '�����Ѵ�'. ����ġ�� ǰ������� �����ϴ� ����� �Ʒ��� �ڼ��� �����Ѵ�.
  2. �ڿ�������(Transparent) ���������� �������� RFC 2295�� ���ǵ� ������� ��û�� ��쿡�� ����Ѵ�. �� �������� '������' ������ ������ ������ ���������� �ο��Ѵ�. �׷��� ����� �������� �˰����� �޷ȴ�. �ڿ������� ��������߿� �������� ����ġ���� RFC 2296�� ���ǵ� '���� �������� �˰�����(remote variant selection algorithm)'�� ��û�� �� �ִ�.

������ ����

���� ����
Media Type �������� Accept ����� ��ȣ�� ��Ÿ����. �� �׸��� ǰ������� ���� �� �ִ�. ������ ������ ǰ������� ("qs" �Ķ����) ���� �� �ִ�.
Language �������� Accept-Language ����� ��ȣ�� ��Ÿ����. �� �׸��� ǰ������� ���� �� �ִ�. ������ ���� �� ���� (Ȥ�� �ƹ� �� ����) �� �ִ�.
Encoding �������� Accept-Encoding ����� ��ȣ�� ��Ÿ����. �� �׸��� ǰ������� ���� �� �ִ�.
Charset �������� Accept-Charset ����� ��ȣ�� ��Ÿ����. �� �׸��� ǰ������� ���� �� �ִ�. ������ media type�� �Ķ���ͷ� ���������� ��Ÿ�� �� �ִ�.

����ġ ���� �˰�����

����ġ�� ���������� ���� '������' ������ (�ִٸ�) �����ϱ����� �Ʒ� �˰������� ����Ѵ�. �� �˰������� ������ �� ����. ������ ���� �����Ѵ�:

  1. ����, ������ �� ������ ���� �ش��ϴ� Accept* ����� �˻��ϰ�, �� ������ ǰ������ �ű��. � ������ Accept* ����� �޾Ƶ����� �ʴ� ������ �ĺ����� �����Ѵ�. � ������ ���������� 4 �ܰ�� ����.
  2. �ĺ����� �ϳ��� �����Ͽ� '������' ������ ã�´�. ���� �� �˻�� ������� �Ͼ��. �� �˻翡�� ���õ������� ������ ���ܵȴ�. �� �˻��� �� ������ ������ �̸� ������ �������� �����ϰ� 3 �ܰ�� ����. ���� ������ ������ ���� �˻縦 �����Ѵ�.
    1. Accept ����� ǰ������� ������ media type�� ���� ǰ������ ���Ͽ� ���� ���� ���� ���� ������ �����Ѵ�.
    2. ���� ���� ���(language) ǰ������� ���� ������ �����Ѵ�.
    3. Accept-Language ����� (�ִٸ�) ���� ����� ���� Ȥ�� LanguagePriority ���þ (�ִٸ�) ���� ����� ������ ������ ���� ������ �� ���� ������ �����Ѵ�.
    4. ���� ���� (text/html media type�� ������ ��Ÿ����) 'level' media �Ķ���͸� ���� ������ �����Ѵ�.
    5. Accept-Charset ����� ������ ���� ������ charset media �Ķ���͸� ���� ������ ã�´�. ����� ���ٸ� ISO-8859-1 ���������� ���� ��ȣ�Ѵ�. text/* media type�� �������� ���������� Ư�� �������հ� ����������� ������ ISO-8859-1�� �����Ѵ�.
    6. ISO-8859-1�� �ƴ� charset media �Ķ���͸� ���� �������� �����Ѵ�. �׷� ������ ���ٸ�, ��� ��� ������ �����Ѵ�.
    7. ���� ������ ���ڵ��� ���� ������ �����Ѵ�. user-agent�� ������ ���ڵ��� ���� ������ �ִٸ� �� �������� �����Ѵ�. �׷����ʰ� ���ڵ��� ������ ���ڵ��ȵ� ������ ���� �ִٸ� ���ڵ��ȵ� �������� �����Ѵ�. ������ ��� ���ڵ��Ǿ��ų� ��� ���ڵ��ȵ� ��� ��� ������ �����Ѵ�.
    8. content length�� ���� ���� ������ �����Ѵ�.
    9. ���� ���� ù���� ������ �����Ѵ�. �̴� type-map ������ �տ� ���԰ų�, ���丮���� ������ ���� ��� ���ϸ��� ASCII �ڵ� ������ �Ͽ� �տ� ������ ���̴�.
  3. ���� �˰������� '������' ������ �����ߴ�. �̰��� �������� ������. HTTP ���� ��� Vary�� ������ ������ ��Ÿ���� �ȴ�. (�������� ij���� �ڿ��� ij���Ҷ� �� ������ ����� �� �ִ�.) ��.
  4. �� �ܰ迡 �����ߴٸ� (��� �������� �������ϱ� ������) � ������ ������ �ȵ� ����. ("No acceptable representation"�� ���ϴ�) ���� 406�� �������� ��밡���� ������ ����� ���� HTML ������ ������ ������. ��, HTML Vary ����� ������ ������ ��Ÿ����.
top

ǰ����� �����ϱ�

����ġ�� ���� ���� ����ġ ���� �˰������� ������ ��Ű���ʰ� ǰ������� �����Ѵ�. ������ �����ϰ� ��Ȯ�� ������ �������ʴ� ���������� (�˰�������) �� ���� ����� ������ ���ؼ���. �θ� ���̴� �������� �Ϻδ� ���� �߸��� ������ �����ϵ��� Accept ����� ������. �������� �����ϰ� �ùٸ� ������ �����ٸ�, ������ �����ʴ´�.

Media Type�� ���ϵ�ī��

Accept: ��û ����� media type�� ���� ��ȣ�� ��Ÿ����. ��, *�� � ���ڿ��̶� �����ϱ⶧���� "image/*"�� "*/*" ���� '���ϵ�ī��' media type�� ����� ���� �ִ�. �׷��� ������ ���� ��û��:

Accept: image/*, */*

"image/"�� �����ϴ� � type�� �ٸ� � type�� �������� �ǹ��Ѵ�. � �������� �ڽ��� ������ �ٷ� �� �ִ� type�� �߰��� ���ϵ�ī�带 ������. ���� ���:

Accept: text/html, text/plain, image/gif, image/jpeg, */*

������ ���� ������ type�� ��ȣ������ �ٸ� ǥ���� �ִٸ� �װ͵� �������� ��Ÿ���� ���ؼ���. �������� ������ ���� ���� ������ ���� ���������� ǰ������ ����� ���̴�.

Accept: text/html, text/plain, image/gif, image/jpeg, */*; q=0.01

���� ������ type�� ǰ������� ��� �⺻���� (���� ����) 1.0�� ������. ���ϵ�ī�� */*�� ���� ��ȣ�� 0.01�� �����Ƿ� ���� ������ type�� �´� ������ ���� ��쿡�� �ٸ� type���� ���ȴ�.

Accept: ����� q ����� ���� ���� "*/*"�� �ִٸ�, ����ġ�� �ٶ����� �ൿ�� ���� q ������ 0.01�� �����Ѵ�. ��, "type/*" ������ ���ϵ�ī�忡�� ("*/*"���ٴ� �� ��ȣ�ϵ���) 0.02�� �����Ѵ�. Accept: ������� q ����� ������ media type�� �ִٸ� �̷� Ư���� ���� �߰����� �ʴ´�. �׷��� �������� ������ ������ �������� ��û�� ��û�ѵ��� ó���Ѵ�.

���(language) ������ ����

����ġ 2.0�� ��� ������ ������ ��� �ε巴�� �����ϱ����� ���� �˰����� ���� ���ܸ� � �߰��ߴ�.

Ŭ���̾�Ʈ�� ������ �������� ��û������ ������ �������� ���� Accept-language�� �´� �������� �� �Ѱ��� ã���� ������ ������, �׷��� ���� ��� ������ Ŭ���̾�Ʈ���� "No Acceptable Variant"�� "Multiple Choices" ������ ������. �̷� �������� ���ϱ����� �� ��� Accept-language�� �����ϰ� Ŭ���̾�Ʈ�� ��û�� ��Ȯ�� ������ ������ ������ �������� ����ġ�� ������ �� �ִ�. ForceLanguagePriority ���þ�� ������ �̷� �������� �ϳ� Ȥ�� �Ѵٸ� �����ϰ� LanguagePriority ���þ�� �Ǵ��ϵ��� �Ѵ�.

��, ������ �´� �� ��ã�� ��� �θ�� ã�� ���� �ִ�. ���� ��� Ŭ���̾�Ʈ�� ������� ���ϴ� en-GB ���� ������ ��û�� ���, HTTP/1.1 ǥ�ؿ� ������ ������ en���θ� ǥ�õ� ������ �Ϲ������� �������� ���Ѵ�. (�׷��� ������� �����ϴ� ���ڰ� �Ϲ����� ��� ������ �� �����Ƿ� Accept-Language ����� en-GB�� �����ϰ� en�� �������������� ���� Ȯ���� �߸��� �������� �����϶�. �������� ���� ���� Ŭ���̾�Ʈ���� �̷� ������ �⺻�������ִ�.) �ٸ� �� ã�� ���Ͽ� ������ "No Acceptable Variants" ������ �����ų� LanguagePriority�� ���ư��� �Ѵٸ�, ������ ������� �Ծ��� �����ϰ� en-GB�� en ������ �����Ѵ�. �Ϲ������� ����ġ�� �θ�� �ſ� ���� ǰ�������� Ŭ���̾�Ʈ�� ����� ��Ͽ� �߰��Ѵ�. �׷��� Ŭ���̾�Ʈ�� "en-GB; q=0.9, fr; q=0.8"�� ��û�ϰ� ������ "en"�� "fr" ������ �ִٸ�, "fr" ������ ���õ��� �����϶�. �̴� HTTP/1.1 ǥ���� ��Ű��, �ùٷ� ������ Ŭ���̾�Ʈ�� ȿ�������� �����ϱ������̴�.

����ڰ� ��ȣ�ϴ� �� �˾Ƴ������� (��Ű�� Ư���� URL-��� ����) ���� ����� �����ϱ����� ����ġ 2.0.47���� mod_negotiation�� prefer-language��� ȯ�溯���� �ν��Ѵ�. �� ȯ�溯���� �����ϰ� ������ ����±׸� �����Ѵٸ�, mod_negotiation�� �ش��ϴ� ������ �����Ϸ��� �õ��Ѵ�. �׷� ������ ���ٸ� �Ϲ����� ��������� �����Ѵ�.

����

SetEnvIf Cookie "language=(.+)" prefer-language=$1

top

�ڿ�������(transparent) ���������� Ȯ��

����ġ�� ������ ���� �ڿ������� ����Ȯ�� ���������� (RFC 2295) Ȯ���Ѵ�. ���� ����� ���ο� {encoding ..}�� Ư�� content-encoding�� ���� �������� ��Ī�Ѵ�. RVSA/1.0 �˰������� (RFC 2296) ��Ͽ��� ���ڵ��� ������ �ν��� �� �ְ�, ���ڵ��� Accept-Encoding ��û ����� �´� ��� ���ڵ��� �����鵵 �ĺ��� ����ϵ��� Ȯ��Ǿ���. RVSA/1.0 ������ ������ ������ ã�� ���� ���� ǰ������� �Ҽ��� 5�ڸ����� �ݿø����� �ʴ´�.

top

�����۸�ũ�� �̸���Ģ�� ���Ͽ�

���(language) ������ ����Ѵٸ� ������ ���� Ȯ���ڸ� ������ Ȯ������ ������ ���� ��������Ƿ� ���ϸ��� ���� �ٸ� �̸���Ģ�� ����� �� �ִ�. (�ڼ��� ������ mod_mime ������ �����϶�.)

�������� ������ MIME-type Ȯ���� (���� ���, html), ��쿡 ���� encoding Ȯ���� (���� ���, gz), ���Ͽ� ���� ��� ������ �ִ� ��� ���� ��� Ȯ���ڸ� (���� ���, en) ������.

����:

������ ��� ���ϸ��� �� ���Ͽ� ���� ��ȿ�ϰ� ��ȿ�������� �����۸�ũ�� ���δ�:

���ϸ� ��ȿ�� �����۸�ũ ��ȿ�������� �����۸�ũ
foo.html.en foo
foo.html
-
foo.en.html foo foo.html
foo.html.en.gz foo
foo.html
foo.gz
foo.html.gz
foo.en.html.gz foo foo.html
foo.html.gz
foo.gz
foo.gz.html.en foo
foo.gz
foo.gz.html
foo.html
foo.html.gz.en foo
foo.html
foo.html.gz
foo.gz

�� ǥ�� ���� �����۸�ũ�� � Ȯ���ڵ� ���� �̸��� (���� ���, foo) �׻� ����� �� ������ �� �� �ִ�. �� ��� ������ ������ ���� ������ ���� �� �־, ���� ��� ���̷���ũ ������ �����Ͼʰ� html ������ shtml�̳� cgi�� ������ �� �ִٴ� ���̴�.

��� �����۸�ũ�� MIME-type�� (���� ���, foo.html) ����ϰ� �ʹٸ� (encoding Ȯ���ڰ� �ִٸ� �̰͵� �����Ͽ�) ��� Ȯ���ڸ� MIME-type Ȯ���ں��� �����ʿ� (���� ���, foo.html.en) �ξ���Ѵ�.

top

ij���� ���Ͽ�

ij���� ǥ���� �����ϸ� ǥ���� ��û URL�� ������Ų��. ������ �� URL�� ��û�ϸ� ij���� ����� ǥ���� ����Ѵ�. �׷��� ������ ������ ������ �ڿ��� ��� ù��° ��û�� ������ ij���Ǿ� ���� ��û�� ij���� �߸��� ������ ���� �� �ִ�. �̸� �������� ����ġ�� ���� ���������� ��ȯ�Ǵ� ��� ��û�� HTTP/1.0 Ŭ���̾�Ʈ�� ij���� ���ϵ��� ǥ�ø� �Ѵ�. ��, ����ġ�� ������ ������ ij���� ����ϴ� HTTP/1.1 ���������� ����� �����Ѵ�.

CacheNegotiatedDocs ���þ�� HTTP/1.0 ȣȯ Ŭ���̾�Ʈ(������ Ȥ�� ij��)�� ���� ��û�� ���� ������ ������ ij���� �� �ְ� �Ѵ�. �� ���þ�� ������ ����ȣ��Ʈ ������ ����ϸ�, �ƱԸ�Ʈ�� �����ʴ´�. �� ���þ�� HTTP/1.1 Ŭ���̾�Ʈ�� ��û���� ���谡 ����.

HTTP/1.1 Ŭ���̾�Ʈ���� ����ġ�� ������ ���� ������ �˷��ִ� Vary HTTP ��������� ������. �� ������ ����Ͽ� ���� ��û�� ij���� ���纻���� ��ü�� �� �ִ��� �Ǵ��� �� �ִ�. ����� ������ ������� ij���� ���纻�� ���Ѵٸ� force-no-vary ȯ�溯���� �����Ѵ�.

������ ���:  en  |  fr  |  ja  |  ko  |  tr 

top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our mailing lists.