network path reference
DESCRIPTION
special relative path.TRANSCRIPT
![Page 1: Network path reference](https://reader034.vdocuments.us/reader034/viewer/2022052508/55958a6e1a28ab10638b45e9/html5/thumbnails/1.jpg)
NETWORK-PATH REFERENCEsol
![Page 2: Network path reference](https://reader034.vdocuments.us/reader034/viewer/2022052508/55958a6e1a28ab10638b45e9/html5/thumbnails/2.jpg)
SSL 구축 의무화
•방통위 개인정보보호법 - 2012년 8월18일 시행.
•개인정보를 취급하는 홈페이지 대상.
•보안서버(SSL) 구축이 의무.
•위반시 1,000만원이하 과태료 부과 예정.
![Page 3: Network path reference](https://reader034.vdocuments.us/reader034/viewer/2022052508/55958a6e1a28ab10638b45e9/html5/thumbnails/3.jpg)
SSL서버만 구축하면,
•사용자가 https로 시작하는 주소로 접속할 때,
•그 페이지에 http로 시작하는 img, js, css 파일이 있는 경우.
• IE와 FF에서는 보안경고창 발생 !
![Page 4: Network path reference](https://reader034.vdocuments.us/reader034/viewer/2022052508/55958a6e1a28ab10638b45e9/html5/thumbnails/4.jpg)
그래서 보통 이렇게 수정.
•사용자가 접속한 프로토콜를 변수로 설정.• $protocol = is_ssl() ? “https” : “http”;
• html내 img, js, css의 절대경로를 http와 https를 분기.• <img src=”{$protocol}://example.com/img/logo.png” alt=”” />
• <script type=”text/javascript” src=”{$protocol}://code.jquery.com/jquery-1.8.0.min.js” />
• <link rel="stylesheet" href="{$protocol}://example.com/css/layout.css" type="text/css" media="all" />
![Page 5: Network path reference](https://reader034.vdocuments.us/reader034/viewer/2022052508/55958a6e1a28ab10638b45e9/html5/thumbnails/5.jpg)
그럼 모두 HTTPS로 바꾸면 ?
• https(SSL)의 성능 문제.• ssl handshake, 데이터 암호화/복호화 등에 따른 비용 추가.
• 서버의 CPU 사용량 증가.
• http 대비 현저히 낮은 TPS.
•따라서, 꼭 필요한 곳에서만 https 사용이 필요.
![Page 6: Network path reference](https://reader034.vdocuments.us/reader034/viewer/2022052508/55958a6e1a28ab10638b45e9/html5/thumbnails/6.jpg)
다른 방법. 단지 SLASH 두개만 !
•사용자가 http로 접속하든, https로 접속하든 알아서 변경하여 요청.
•브라우져의 보안경고창 회피.• <img src=”//example.com/img/logo.png” alt=”” />
• <script type=”text/javascript” src=”//code.jquery.com/jquery-1.8.0.min.js” />
• <link rel="stylesheet" href="//example.com/css/layout.css" type="text/css" media="all" />
![Page 7: Network path reference](https://reader034.vdocuments.us/reader034/viewer/2022052508/55958a6e1a28ab10638b45e9/html5/thumbnails/7.jpg)
RFC 3986• 4.2. Relative Reference
A relative reference takes advantage of the hierarchical syntax (Section 1.2.3) to express a URI reference relative to the name space of another hierarchical URI.
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-empty
The URI referred to by a relative reference, also known as the target URI, is obtained by applying the reference resolution algorithm of Section 5.
A relative reference that begins with two slash characters is termed a network-path reference; such references are rarely used. A relative reference that begins with a single slash character is termed an absolute-path reference. A relative reference that does not begin with a slash character is termed a relative-path reference.
A path segment that contains a colon character (e.g., "this:that") cannot be used as the first segment of a relative-path reference, as it would be mistaken for a scheme name. Such a segment must be preceded by a dot-segment (e.g., "./this:that") to make a relative-path reference.
• http://tools.ietf.org/html/rfc3986#section-4.2
![Page 8: Network path reference](https://reader034.vdocuments.us/reader034/viewer/2022052508/55958a6e1a28ab10638b45e9/html5/thumbnails/8.jpg)
“NETWORK-PATH REFERENCE”
• URL에서 프로토콜 이후부터의 상대경로를 표현.
•즉, double slashes(//) 로 시작하는 URL 경로.
• IE 하위 버전을 포함한 모든 브라우져에서 지원.
![Page 9: Network path reference](https://reader034.vdocuments.us/reader034/viewer/2022052508/55958a6e1a28ab10638b45e9/html5/thumbnails/9.jpg)
하지만,
• IE 형제에겐 항상 문제가 있었으니...
• IE7 과 IE8 에서 network-path reference를 사용하는 css file을 서버에 두번 요청하는 문제가 있음.
•캐쉬 설정이 되어 있다면, 캐쉬 hit가 되니 문제는 없을 듯.