JP2011257810A - Relay server device, cookie control method and cookie control program - Google Patents

Relay server device, cookie control method and cookie control program Download PDF

Info

Publication number
JP2011257810A
JP2011257810A JP2010129428A JP2010129428A JP2011257810A JP 2011257810 A JP2011257810 A JP 2011257810A JP 2010129428 A JP2010129428 A JP 2010129428A JP 2010129428 A JP2010129428 A JP 2010129428A JP 2011257810 A JP2011257810 A JP 2011257810A
Authority
JP
Japan
Prior art keywords
cookie
domain
browser
script
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2010129428A
Other languages
Japanese (ja)
Other versions
JP5581820B2 (en
Inventor
Tomohiro Otake
智裕 大嶽
Falkenhagen Matthew
フォルケンハーゲン マシュー
Akihiko Matsuo
昭彦 松尾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2010129428A priority Critical patent/JP5581820B2/en
Publication of JP2011257810A publication Critical patent/JP2011257810A/en
Application granted granted Critical
Publication of JP5581820B2 publication Critical patent/JP5581820B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

PROBLEM TO BE SOLVED: To properly execute writing processing of cookie information even when accessing from a browser to a web application via a relay server.SOLUTION: A relay server 10 replaces a substitution for a Set-Cookie in a response header from a web server 20 or a document.cookie in a script with a call of a setCookieFunc function, and adds into an HTML document. And a browser 30 performs an URI substitution on an ancestor domain with the relay server, and creates an iframe element for displaying a URI added a file name which is reserved in a directory with a cookie path designation. And the browser 30 provides a cookie setting instruction from a master frame to a domain of a slave frame by performing cross domain communication such as a postMessage on the created iframe. The cookie setting is performed in association with the ancestor domain on the iframe side.

Description

本発明は、中継サーバ装置、クッキー制御方法およびクッキー制御プログラムに関する。   The present invention relates to a relay server device, a cookie control method, and a cookie control program.

近年、Webサーバがブラウザを通じてクライアントのコンピュータに一時的にクッキー情報を書き込んで保存させるクッキー(cookie)に関する技術が知られている。このように保存されたクッキー情報について、ブラウザがアクセスした複数のドメインの祖先ドメインが共通する場合には、クッキー情報を共有して利用することが知られている。例えば、ドメイン「sso.example.com」とドメイン「ap1.example.com」とは、祖先ドメイン「example.com」が共通しており、「sso.example.com」にアクセスしたブラウザと「ap1.example.com」にアクセスしたブラウザとでクッキー情報を共有して利用する。   2. Description of the Related Art In recent years, a technique related to cookies in which a Web server temporarily writes and stores cookie information on a client computer through a browser is known. It is known that the cookie information stored in this way is shared and used when the ancestor domains of a plurality of domains accessed by the browser are common. For example, the domain `` sso.example.com '' and the domain `` ap1.example.com '' have the same ancestor domain `` example.com '', and the browser that accessed `` sso.example.com '' and `` ap1.example.com ''. Share and use cookie information with the browser that accessed "example.com".

ここで、図14の例を用いて、祖先ドメインが共通する場合に、クッキーを共有して利用する処理について説明する。図14は、祖先ドメインが共通する場合に、クッキーを共有する処理について説明する図である。例えば、図14に示すように、ユーザがクライアント装置のブラウザA上から「sso.example.com」のWebアプリケーションでログイン処理を行うと、祖先ドメイン「example.com」の指定があるクッキーセット指示がWebサーバからブラウザAへ送信される。図14の例では、クッキーセット指示として、「Set-Cookie:sid=1234;domain=.example.com」というSet-Cookieヘッダを含んだHTTP(Hypertext Transfer Protocol)レスポンスがWebサーバからブラウザAに送信される。   Here, a process for sharing and using a cookie when an ancestor domain is common will be described using the example of FIG. FIG. 14 is a diagram illustrating processing for sharing a cookie when an ancestor domain is common. For example, as shown in FIG. 14, when the user performs a login process with the web application “sso.example.com” from the browser A of the client device, a cookie set instruction with the designation of the ancestor domain “example.com” is displayed. It is transmitted from the Web server to browser A. In the example of FIG. 14, an HTTP (Hypertext Transfer Protocol) response including a Set-Cookie header of “Set-Cookie: sid = 1234; domain = .example.com” is transmitted from the Web server to the browser A as a cookie setting instruction. Is done.

そして、ブラウザAは、クッキーセット指示「Set-Cookie:sid=1234;domain=.example.com」を受信すると、祖先ドメイン「example.com」を特定し、祖先ドメイン「example.com」に対応付けてクッキー情報「sid=1234」を書き込む。   Upon receiving the cookie set instruction “Set-Cookie: sid = 1234; domain = .example.com”, the browser A identifies the ancestor domain “example.com” and associates it with the ancestor domain “example.com”. Write the cookie information “sid = 1234”.

このように書き込まれたクッキーは、祖先ドメイン「.example.com」に対応付けて記憶されているため、「sso.example.com」だけでなく「ap1.example.com」にアクセスする場合にも、クッキーを送信する。例えば、「sso.example.com」へのログイン処理後に、ユーザがブラウザBから「ap1.example.com」にアクセスすると、「sso.example.com」へのログイン処理で送られてきたクッキー「Cookie:sid=1234」をHTTPリクエストのヘッダとしてWebサーバに送信する。   The cookie written in this way is stored in association with the ancestor domain “.example.com”, so even when accessing “ap1.example.com” as well as “sso.example.com” , Send cookies. For example, after the login process to “sso.example.com”, when the user accesses “ap1.example.com” from the browser B, the cookie “Cookie” sent in the login process to “sso.example.com” : sid = 1234 "is transmitted to the Web server as an HTTP request header.

また、Webサーバとクライアント装置との間に、URI(Uniform Resource Identifier)を置換する中継サーバが設けられている場合がある。具体的には、中継サーバは、URIのドメイン部分のドット「.」をハイフン「-」に置換するとともに中継サーバのホスト名を付加して、URIを置換する。例えば、図14の例を用いて説明すると、中継サーバは、中継サーバのホスト名が「r.test」である場合には、「sso.example.com」を「http-sso-example-com.r.test」に置換し、「ap1.example.com」を「http-ap1-example-com.r.test」に置換する。   In some cases, a relay server that replaces a Uniform Resource Identifier (URI) is provided between the Web server and the client device. Specifically, the relay server replaces the URI by replacing the dot “.” In the domain part of the URI with a hyphen “-” and adding the host name of the relay server. For example, referring to the example of FIG. 14, when the host name of the relay server is “r.test”, the relay server changes “sso.example.com” to “http-sso-example-com. Replace with “r.test” and replace “ap1.example.com” with “http-ap1-example-com.r.test”.

特開2009−271676号公報JP 2009-271676 A

しかしながら、上述した中継サーバがURIを置換する技術では、URIのドメイン部分が置換されるので、ドメインの親子関係が消滅してしまい、クッキー共有ができなくなり、クッキー情報の書き込み処理を適切に実行することができないという問題があった。   However, in the above-described technology in which the relay server replaces the URI, the domain part of the URI is replaced. Therefore, the parent-child relationship of the domain disappears, cookie sharing becomes impossible, and the cookie information writing process is appropriately executed. There was a problem that I could not.

例えば、図14の例では、「sso.example.com」が「http-sso-example-com.r.test」に置換され、「ap1.example.com」が「http-ap1-example-com.r.test」に置換され、祖先ドメインである「example.com」が「http-example-com.r.test」に置換されることとなる。ここで、ブラウザ側では、ドットがハイフンになっているので、「http-sso-example-com.r.test」および「http-ap1-example-com.r.test」の祖先ドメインが「http-example-com.r.test」であることを特定できない。このため、ドメインの親子関係が消滅してしまい、祖先ドメインのクッキー情報の書き込み処理を適切に実行することができない。   For example, in the example of FIG. 14, “sso.example.com” is replaced with “http-sso-example-com.r.test”, and “ap1.example.com” is “http-ap1-example-com. “example.com”, which is an ancestor domain, is replaced with “http-example-com.r.test”. Here, on the browser side, the dot is a hyphen, so the ancestor domains of "http-sso-example-com.r.test" and "http-ap1-example-com.r.test" are "http- "example-com.r.test" cannot be specified. For this reason, the parent-child relationship of the domain disappears, and the cookie information writing process of the ancestor domain cannot be appropriately executed.

一つの側面では、中継サーバを経由してブラウザからWebアプリケーションにアクセスする場合であっても、クッキー情報の書き込み処理を適切に実行することを目的とする。   An object of one aspect is to appropriately execute cookie information writing processing even when a Web application is accessed from a browser via a relay server.

第一の案では、サーバからブラウザに対するクッキー書き込み指示情報を受信した場合に、該クッキー書き込み指示情報をスクリプトの呼び出し情報に置換する。そして、スクリプトの呼び出し情報に対して、ブラウザのリクエスト先ドメインの祖先ドメインに対応するフレームを作成させるとともに該フレームに祖先ドメインに対応するクッキーの書き込み指示をクロスドメイン通信で送信するスクリプトを追加する。   In the first proposal, when the cookie write instruction information for the browser is received from the server, the cookie write instruction information is replaced with script call information. Then, a script for creating a frame corresponding to the ancestor domain of the request destination domain of the browser and adding a cookie write instruction corresponding to the ancestor domain to the frame is added to the script call information.

中継サーバを経由してブラウザからWebアプリケーションにアクセスする場合であっても、クッキー情報の書き込み処理を適切に実行することができる。   Even when a Web application is accessed from a browser via a relay server, cookie information writing processing can be appropriately executed.

図1は、実施例1に係る中継サーバ装置の構成を示すブロック図である。FIG. 1 is a block diagram illustrating the configuration of the relay server device according to the first embodiment. 図2は、クッキーの書き込み処理を説明する図である。FIG. 2 is a diagram illustrating a cookie writing process. 図3は、クッキーの読み取り処理を説明する図である。FIG. 3 is a diagram illustrating a cookie reading process. 図4は、実施例1に係る中継サーバ装置によるクッキー書き込み処理の流れを示すシーケンス図である。FIG. 4 is a sequence diagram illustrating the flow of the cookie writing process performed by the relay server device according to the first embodiment. 図5は、実施例1に係る中継サーバ装置によるクッキー読み取り処理の流れを示すシーケンス図である。FIG. 5 is a sequence diagram illustrating the flow of the cookie reading process performed by the relay server device according to the first embodiment. 図6は、実施例2に係る中継サーバ装置の構成を示すブロック図である。FIG. 6 is a block diagram illustrating the configuration of the relay server device according to the second embodiment. 図7は、中継サーバが受信する画像データのリクエストの一例を説明する図である。FIG. 7 is a diagram illustrating an example of a request for image data received by the relay server. 図8は、祖先ドメイン氏名のあるクッキーがヘッダに付与された画像データの一例を説明する図である。FIG. 8 is a diagram illustrating an example of image data in which a cookie having an ancestor domain name is added to a header. 図9は、一時保管部のデータベータに記憶されるデータ例を示す図である。FIG. 9 is a diagram illustrating an example of data stored in the data beta of the temporary storage unit. 図10は、実施例2に係る中継サーバ装置による画像クッキー処理の流れを示すシーケンス図である。FIG. 10 is a sequence diagram illustrating the flow of the image cookie process performed by the relay server device according to the second embodiment. 図11は、実施例2に係る中継サーバ装置による処理の流れを示すフローチャートである。FIG. 11 is a flowchart illustrating a process flow of the relay server device according to the second embodiment. 図12は、実施例2に係る中継サーバ装置による処理の流れを示すフローチャートである。FIG. 12 is a flowchart illustrating a process flow of the relay server device according to the second embodiment. 図13は、クッキー書込読取プログラムを実行するコンピュータを示す図である。FIG. 13 is a diagram illustrating a computer that executes a cookie writing / reading program. 図14は、祖先ドメインが共通する場合に、クッキーを共有する処理について説明する図である。FIG. 14 is a diagram illustrating processing for sharing a cookie when an ancestor domain is common.

以下に添付図面を参照して、この発明に係る中継サーバ装置、クッキー制御方法およびクッキー制御プログラムの実施例を詳細に説明する。   Exemplary embodiments of a relay server device, a cookie control method, and a cookie control program according to the present invention will be described below in detail with reference to the accompanying drawings.

以下の実施例では、実施例1に係る中継サーバの構成および処理の流れを順に説明し、最後に実施例1による効果を説明する。   In the following embodiments, the configuration and processing flow of the relay server according to the first embodiment will be described in order, and finally the effects of the first embodiment will be described.

[中継サーバの構成]
まず最初に、図1を用いて、中継サーバ10の構成を説明する。図1は、実施例1に係る中継サーバ10の構成を示すブロック図である。図1に示すように、この中継サーバ10は、リクエスト判別部11、中継部12、クッキー操作ページ返却部13を有し、Webサーバ20および利用者端末のブラウザ30と接続される。以下にこれらの各部の処理を説明する。
[Configuration of relay server]
First, the configuration of the relay server 10 will be described with reference to FIG. FIG. 1 is a block diagram illustrating the configuration of the relay server 10 according to the first embodiment. As shown in FIG. 1, the relay server 10 includes a request determination unit 11, a relay unit 12, and a cookie operation page return unit 13, and is connected to a Web server 20 and a browser 30 of a user terminal. The processing of each of these units will be described below.

Webサーバ20は、中継サーバ10を経由して利用者端末のブラウザ30からアクセスがあると、アクセスをしてきた利用者端末のブラウザ30に対してHTML(HyperText Markup Language)文書や画像などの情報をレスポンスとして中継サーバ10経由で送信する。ブラウザ30は、中継サーバ10を経由してWebサーバ20にリクエストを送信し、リクエストに対するレスポンスを中継サーバ10経由でWebサーバ20から受信する。   When accessed from the browser 30 of the user terminal via the relay server 10, the Web server 20 sends information such as an HTML (HyperText Markup Language) document or image to the browser 30 of the accessing user terminal. The response is transmitted via the relay server 10. The browser 30 transmits a request to the Web server 20 via the relay server 10 and receives a response to the request from the Web server 20 via the relay server 10.

リクエスト判別部11は、リクエストのパスが特定のファイル名(例えば、「CookieHandler.html」)であるか判定し、リクエストのパスが特定のファイル名である場合に、クッキー操作ページへのリクエストであると判別する。具体的には、リクエスト判別部11は、ブラウザからリクエストを受信し、リクエストのパス部分を検出し、パスのファイル名と特定のファイル名(例えば、「CookieHandler.html」)とが一致しているか判定する。   The request determination unit 11 determines whether the request path has a specific file name (for example, “CookieHandler.html”), and when the request path has a specific file name, the request determination unit 11 is a request to the cookie operation page. Is determined. Specifically, the request determination unit 11 receives a request from the browser, detects the path portion of the request, and whether the file name of the path matches a specific file name (for example, “CookieHandler.html”). judge.

この結果、リクエスト判別部11は、リクエストのパス部分を検出し、パスのファイル名と特定のファイル名とが一致すると判定した場合には、後述するクッキー操作ページ返却部13へリクエストを通知する。また、リクエスト判別部11は、リクエストのパス部分を検出し、パスのファイル名と特定のファイル名とが一致しないと判定した場合には、後述する中継部12へURIを通知する。   As a result, the request determination unit 11 detects the path part of the request, and when determining that the path file name matches the specific file name, notifies the request to the cookie operation page return unit 13 described later. Further, the request determination unit 11 detects the path portion of the request, and when determining that the file name of the path does not match the specific file name, notifies the relay unit 12 described later of the URI.

例えば、リクエスト判別部11は、リクエストのパスが「/CookieHandler.html」や「/dir1/dir2/CookieHandler.html」となっているリクエストについては、クッキー操作ページ返却部13にリクエストを通知する。   For example, for the request whose request path is “/CookieHandler.html” or “/dir1/dir2/CookieHandler.html”, the request determination unit 11 notifies the cookie operation page return unit 13 of the request.

また、リクエスト判別部11は、リクエストのパスが「/」や「/CookieHandler.html/dir/」なっているリクエストについては、中継部12へリクエストを通知する。なお、「CookieHandler.html」などの指定のファイル名は、中継サーバが自由に設定できるものであり、別のファイル名でもよく、他のWebサーバで使われていないファイル名で設定するのがよい。   Further, the request determination unit 11 notifies the relay unit 12 of a request for a request whose request path is “/” or “/CookieHandler.html/dir/”. The specified file name such as “CookieHandler.html” can be set freely by the relay server, and may be a different file name or a file name that is not used by other Web servers. .

中継部12は、Webサーバ20と利用者端末のブラウザ30との間の通信を中継し、リクエスト代行部12a、URI置換部12b、クッキー置換部12c、スクリプト追加部12dを有する。   The relay unit 12 relays communication between the Web server 20 and the browser 30 of the user terminal, and includes a request proxy unit 12a, a URI replacement unit 12b, a cookie replacement unit 12c, and a script addition unit 12d.

URI置換部12bは、Webサーバ20からブラウザ30に対するレスポンスを受信した場合に、ブラウザ30のURIを置換する。具体的には、URI置換部12bは、Webサーバ20から受信したURIのドメイン部分のドット「.」をハイフン「-」に置換するとともに、中継サーバのホスト名「r.test」を付加する。   The URI replacement unit 12 b replaces the URI of the browser 30 when receiving a response to the browser 30 from the Web server 20. Specifically, the URI replacement unit 12b replaces the dot “.” In the domain part of the URI received from the Web server 20 with a hyphen “-” and adds the host name “r.test” of the relay server.

例えば、URI置換部12bは、Webサーバ20から「http://sso.example.com」を受信すると、「http://http-sso-example-com.r.test」に置換する。また、URI置換12bは、ブラウザ30から「http://http-sso-example-com.r.test/login/login」を受信すると、「http://sso.example.com/login/login」に復元し、リクエスト代後部12aに通知する。   For example, when receiving “http://sso.example.com” from the Web server 20, the URI replacing unit 12b replaces it with “http: //http-sso-example-com.r.test”. When the URI replacement 12b receives "http: //http-sso-example-com.r.test/login/login" from the browser 30, the "http://sso.example.com/login/login" To the request charge back part 12a.

リクエスト代行部12aは、利用者端末のブラウザ30から受信したリクエストを受信すると、リクエスト中のドメインを解釈してWebサーバにリクエストを送信する。具体的には、リクエスト代行部12aは、URI置換部12bからURIを受信し、受信されたURIを用いて、Webサーバ20にリクエストを送信する。   When receiving the request received from the browser 30 of the user terminal, the request proxy unit 12a interprets the domain in the request and transmits the request to the Web server. Specifically, the request proxy unit 12a receives a URI from the URI replacement unit 12b, and transmits a request to the Web server 20 using the received URI.

クッキー置換部12cは、Webサーバ20からブラウザ30に対するクッキー書き込み指示情報を受信した場合に、クッキー書き込み指示情報をスクリプトの呼び出し情報に置換する。具体的には、クッキー置換部12cは、Webサーバ20からのレスポンスにSet-CookieヘッダやJava(登録商標)Script中のdocument.cookieへの代入が含まれているか判定する。この結果、Webサーバ20からのレスポンスにSet-Cookieヘッダやスクリプト中のdocument.cookieへの代入が含まれていると判定した場合には、Set-Cookieヘッダやスクリプト中のdocument.cookieをsetCookieFunc関数の呼び出しへと置換する。   The cookie replacement unit 12c replaces the cookie write instruction information with the call information of the script when the cookie write instruction information for the browser 30 is received from the Web server 20. Specifically, the cookie replacement unit 12c determines whether the response from the Web server 20 includes substitution to document.cookie in the Set-Cookie header or Java (registered trademark) Script. As a result, if it is determined that the response from the Web server 20 includes an assignment to the Set-Cookie header or document.cookie in the script, the set.Cookie header or document.cookie in the script is set to the setCookieFunc function. Replace with a call to.

スクリプト追加部12dは、スクリプトの呼び出し情報に対して、ブラウザ20のドメインの祖先ドメインに対応するフレームを作成させるとともにフレームに祖先ドメインに対応するクッキーの書き込み指示をクロスドメイン通信で指示するスクリプトを追加する。例えば、スクリプト追加部12dは、クッキー置換部12cによってsetCookieFunc関数の呼び出しに置換された後に、setCookieFunc関数の定義をHTML文書内に追加する。   The script addition unit 12d adds a script for creating a frame corresponding to the ancestor domain of the domain of the browser 20 to the script call information and instructing the frame to write a cookie corresponding to the ancestor domain by cross-domain communication. To do. For example, the script adding unit 12d adds the definition of the setCookieFunc function to the HTML document after the cookie replacing unit 12c replaces the call with the setCookieFunc function.

また、スクリプト追加部12dは、祖先ドメインのフレームのパスのディレクトリをブラウザ20からのレスポンスの受信先フレームのパスのディレクトリと同じにしたiframe要素を作成するスクリプトを追加する。   Further, the script adding unit 12d adds a script for creating an iframe element in which the directory path of the ancestor domain frame is the same as the path directory of the destination frame of the response from the browser 20.

例えば、スクリプト追加部12dは、親フレームが「http://sso.example.com/login/login」であり、「Set-Cookie:sid=1234;domain=.example.com;path=/」のクッキーが送られてきた場合には、iframeのURIが「http://http-example-com.r.test/login/CookieHandler.html」となる。つまり、祖先ドメインのフレームのパスのディレクトリと受信先フレームのパスのディレクトリとを「/login/」でそろえる。これにより、Set-CookieヘッダやJavaScript中のdocument.cookieへの代入でドメインやパスの指定がある場合にも、適切にクッキーを処理することができる。   For example, the script adding unit 12d has a parent frame “http://sso.example.com/login/login” and “Set-Cookie: sid = 1234; domain = .example.com; path = /”. When a cookie is sent, the URI of the iframe is “http: //http-example-com.r.test/login/CookieHandler.html”. That is, the directory of the ancestor domain frame path and the directory of the destination frame path are aligned with “/ login /”. As a result, even when a domain or path is specified by assignment to document.cookie in the Set-Cookie header or JavaScript, the cookie can be appropriately processed.

また、スクリプト追加部12dは、祖先ドメインに対応するフレームを作成させるとともに該フレームに祖先ドメインのクッキーを取得させて親フレームにクロスドメイン通信で送信させる処理を一定時間ごとに行わせるスクリプトを追加する。   In addition, the script adding unit 12d adds a script that creates a frame corresponding to the ancestor domain and causes the frame to acquire a cookie of the ancestor domain and transmit the cookie to the parent frame by cross domain communication at regular intervals. .

例えば、Webサーバ20からHTMLドキュメントのレスポンスを受信した場合に、HTMLドキュメントに対して祖先ドメインからクッキーをコピーしてくるための読取スクリプトを追加する。   For example, when a response of an HTML document is received from the Web server 20, a reading script for copying a cookie from an ancestor domain is added to the HTML document.

クッキー操作ページ返却部13は、中継サーバ10内に格納されているHTMLとスクリプトで構成されたクッキー操作ページを返信する。ここで、クッキー操作ページとは、ブラウザ30におけるiframe内に読み込まれることを想定されており、ドメインをまたがったクッキーの読書きを行う。なお、クッキー操作ページには、クロスドメイン通信でのセキュリティを保つためのロジックも含めるようにしてもよい。   The cookie operation page return unit 13 returns a cookie operation page composed of HTML and script stored in the relay server 10. Here, the cookie operation page is assumed to be read in an iframe in the browser 30 and reads / writes a cookie across domains. The cookie operation page may include logic for maintaining security in cross-domain communication.

ここで、クッキーの書き込み処理について図2を用いて具体的に説明する。図2に示すように、中継サーバ10は、Webサーバ20からのレスポンスヘッダのSet-Cookieやスクリプト内のdocument.cookieへの代入を受信すると、ヘッダやスクリプトをsetCookieFunc関数への呼び出しへと置換し、setCookieFunc関数をHTML文書内に追加する。例えば、中継サーバ10は、Set-Cookie:sid=1234;domain=.example.com; path=/のヘッダをsetCookieFunc(“sid=1234;domain=.example.com;path=/”)のスクリプトに置換し、ブラウザ30に送信する。   Here, the cookie writing process will be specifically described with reference to FIG. As shown in FIG. 2, when the relay server 10 receives the Set-Cookie of the response header from the Web server 20 or the substitution of document.cookie in the script, the relay server 10 replaces the header or script with a call to the setCookieFunc function. , SetCookieFunc function is added to the HTML document. For example, the relay server 10 sets the header of Set-Cookie: sid = 1234; domain = .example.com; path = / to a script of setCookieFunc (“sid = 1234; domain = .example.com; path = /”). Replace and send to browser 30.

そして、ブラウザ30は、setCookieFunc関数が呼ばれると、祖先ドメインの指定があるか判定する。この結果、ブラウザ30は、祖先ドメインの指定がないと判定した場合には、document.cookieにクッキーの内容を代入することでブラウザのクッキーに登録する。また、ブラウザ30は、祖先ドメインの指定があると判定した場合には、祖先ドメインを中継サーバへのURI置換を行い、親フレームと同じディレクトリにCookieHandler.htmlという予約済みのファイル名を付加したURIを表示するためのiframe要素を作成し、中継サーバ10からCookieHandler.htmlを取得する。   When the setCookieFunc function is called, the browser 30 determines whether an ancestor domain is specified. As a result, when the browser 30 determines that the ancestor domain is not specified, the browser 30 registers the cookie contents in document.cookie to register the browser cookie. If the browser 30 determines that an ancestor domain is specified, the browser 30 replaces the ancestor domain with a relay server, and adds a reserved file name CookieHandler.html to the same directory as the parent frame. Iframe element is displayed, and CookieHandler.html is acquired from the relay server 10.

その後、ブラウザ30は、作成したiframeにpostMessageなどのクロスドメイン通信を行って親フレームから子フレームのドメインにクッキーのセット指示を出す。指示を受けたiframe側のCookieHandler.html内のスクリプトでは、指示元が子孫ドメインであるかを確認する。この結果、指示元が子孫ドメインである場合には、iframe側でdocument.cookieにクッキーの内容を代入することで祖先ドメインへのクッキーセットを行う。   Thereafter, the browser 30 performs cross-domain communication such as postMessage on the created iframe and issues a cookie setting instruction from the parent frame to the child frame domain. In the script in CookieHandler.html on the iframe side that received the instruction, check whether the instruction source is a descendant domain. As a result, when the instruction source is a descendant domain, a cookie set to the ancestor domain is performed by substituting the contents of the cookie into document.cookie on the iframe side.

次に、図3を用いて、クッキーの読み取り処理について具体的に説明する。クッキーの読み取り処理を行うケースとして、ブラウザがHTTPリクエストにCookieヘッダを付与して送信する場合と、スクリプトがdocument.cookieを読み取る場合の2種類がある。図3に示すように、中継サーバ10は、ブラウザ30からのリクエストに対してWebサーバ20からHTMLドキュメントを取得する。   Next, the cookie reading process will be specifically described with reference to FIG. There are two cases in which the cookie reading process is performed: a case in which a browser adds a Cookie header to an HTTP request, and a case in which a script reads document.cookie. As illustrated in FIG. 3, the relay server 10 acquires an HTML document from the Web server 20 in response to a request from the browser 30.

そして、中継サーバ10は、取得したHTMLドキュメントに対してクッキーの読取スクリプトを追加し、ブラウザ30に送信する。その後、読み取りスクリプトがブラウザ30上で実行され、元のドメインの祖先ドメインでCookieHandler.htmlを読み込むためのiframe要素を作成する。   Then, the relay server 10 adds a cookie reading script to the acquired HTML document and transmits it to the browser 30. Thereafter, a reading script is executed on the browser 30 to create an iframe element for reading CookieHandler.html in the ancestor domain of the original domain.

例えば、ブラウザ30が、http://http-ap1-example-com.r.test/dir1/dir2/file.htmlを表示している場合に、元のドメインがap1.example.comなので祖先ドメインがexample.comであるドメインの一つである。また、ディレクトリが/dir1/dir2/であるため、http://http-example-com.r.test/dir1/dir2/CookieHandler.htmlを読み込むためのiframeが作成されることになる。なお、ドメインによっては作成されるiframeの個数はゼロや複数もありうる。   For example, when the browser 30 displays http: //http-ap1-example-com.r.test/dir1/dir2/file.html, the ancestor domain is ap1.example.com because the original domain is ap1.example.com. It is one of the domains that is example.com. Since the directory is / dir1 / dir2 /, an iframe for reading http: //http-example-com.r.test/dir1/dir2/CookieHandler.html is created. Depending on the domain, the number of iframes created may be zero or multiple.

そして、ブラウザ30は、中継サーバ10からCookieHandler.htmlを読み込んだ後に、iframeに対してクロスドメイン通信でクッキーの取得指示を送る。iframe側のCookieHandler.htmlのスクリプトがクロスドメイン通信の送信元を確認して子孫ドメインからの通信であるかを確認する。   Then, after reading CookieHandler.html from the relay server 10, the browser 30 sends a cookie acquisition instruction to the iframe by cross-domain communication. CookieHandler.html script on iframe side confirms the sender of cross domain communication and confirms whether it is communication from descendant domain.

この結果、子孫ドメインからの通信であることの確認が取れた場合には、スクリプトでdocument.cookieの値を読み取る。ここで読み取れるクッキーについて、CookieHandler.htmlのドメインとパスに該当するものを読取ることができる。   As a result, when it is confirmed that the communication is from the descendant domain, the value of document.cookie is read by the script. Cookies that can be read here can be read from CookieHandler.html corresponding to the domain and path.

その後、クロスドメイン通信で親フレームにクッキーの内容を伝える。親フレームは、クロスドメイン通信の送信元が祖先ドメインであることを確認し、document.cookieにクッキーの内容を代入して祖先ドメインのクッキーを親フレームのドメインでも使えるようにする。その後、クッキーの一貫性を保つために、親フレームのdocument.cookieに代入するクッキーは expires を短く設定し、フレーム間でのクッキーの読み取りを一定時間おきに繰り返して実行する。これにより、祖先ドメインであって指定パスに該当するクッキーを読み取ることができる。   Then, the contents of the cookie are transmitted to the parent frame by cross-domain communication. The parent frame confirms that the source of the cross-domain communication is the ancestor domain, and substitutes the contents of the cookie in document.cookie so that the ancestor domain cookie can be used in the parent frame domain. After that, in order to maintain cookie consistency, the cookie to be assigned to the document.cookie of the parent frame is set to expires short, and the cookie reading between frames is repeated at regular intervals. Thereby, it is possible to read a cookie corresponding to the designated path that is an ancestor domain.

[中継サーバによる処理]
次に、図4を用いて、実施例1に係る中継サーバ10によるクッキー書き込み処理を説明する。図4は、実施例1に係る中継サーバ装置によるクッキー書き込み処理の流れを示すシーケンス図である。以下の例では、http://sso.example.com/login/でログイン処理を行うと、Set-Cookie:sid=1234;domain=.example.com;path=/のレスポンスヘッダが返ってくるものとする。
[Processing by relay server]
Next, a cookie writing process by the relay server 10 according to the first embodiment will be described with reference to FIG. FIG. 4 is a sequence diagram illustrating the flow of the cookie writing process performed by the relay server device according to the first embodiment. In the following example, when login processing is performed at http://sso.example.com/login/, a response header of Set-Cookie: sid = 1234; domain = .example.com; path = / is returned And

図4に示すように、中継サーバ10は、ブラウザ30からログインリクエストを受信する(ステップS101)。例えば、初期状態ではブラウザ30がhttp://sso.example.com/login/を中継サーバ10経由のhttp://http-sso-example-com.r.test/login/で開いている。そして、入力フォーム内のユーザ名とパスワードが入力され、ログインボタンが押されると、ブラウザ30がhttp://http-sso-example-com.r.test/login/loginにログインリクエストを送信する。   As shown in FIG. 4, the relay server 10 receives a login request from the browser 30 (step S101). For example, in the initial state, the browser 30 opens http://sso.example.com/login/ at http: //http-sso-example-com.r.test/login/ via the relay server 10. When the user name and password in the input form are input and the login button is pressed, the browser 30 transmits a login request to http: //http-sso-example-com.r.test/login/login.

続いて、中継サーバ10は、中継サーバのリクエスト判別部11がパスの/login/loginが「CookieHandler.html」と異なることから中継部12に処理を割り振る。そして、中継部12のURI置換部12bは、URIの復元を行いhttp://sso.example.com/login/loginというURIを得る(ステップS102)。   Subsequently, the relay server 10 allocates processing to the relay unit 12 because the request determination unit 11 of the relay server has a path / login / login different from “CookieHandler.html”. Then, the URI replacement unit 12b of the relay unit 12 restores the URI and obtains a URI of http://sso.example.com/login/login (step S102).

そして、中継部12のリクエスト代行部12aは、Webサーバ20に対してリクエストを送信する(ステップS103)。続いて、Webサーバ20は、ユーザ名とパスワードのチェックを行って妥当性が確認できると、Set-Cookie:sid=1234;domain=.example.com;path=/ヘッダの付いたレスポンスを中継サーバ10へ返信する(ステップS104)。   Then, the request proxy unit 12a of the relay unit 12 transmits a request to the Web server 20 (step S103). Subsequently, when the Web server 20 checks the user name and password and can confirm the validity, the Web server 20 sends a response with the Set-Cookie: sid = 1234; domain = .example.com; path = / header to the relay server. 10 is returned (step S104).

その後、中継サーバ10は、Webサーバ20から返ってきたレスポンスに対してURI置換、クッキー置換、スクリプト追加を行う(ステップS105)。例えば、中継サーバ10は、クッキー置換として、Set-Cookie:sid=1234; domain=.example.com;path=/のヘッダをsetCookieFunc(“sid=1234;domain=.example.com;path=/”)のスクリプトに置換する。   Thereafter, the relay server 10 performs URI replacement, cookie replacement, and script addition on the response returned from the Web server 20 (step S105). For example, the relay server 10 sets the header of Set-Cookie: sid = 1234; domain = .example.com; path = / as a cookie replacement setCookieFunc (“sid = 1234; domain = .example.com; path = /” ) Script.

そして、中継サーバ10は、URI置換、クッキー置換、スクリプト追加が行われたレスポンスをブラウザ30に送信する(ステップS106)。そして、ブラウザ30は、追加されたスクリプトによってiframeを作成する(ステップS107)。ここで、sso.example.comの祖先ドメインがexample.comの一つだけであり、パスが/login/loginであるため、作成されるiframeのURIがhttp://http-example-com.r.test/login/CookieHandler.htmlとなる。   Then, the relay server 10 transmits a response in which the URI replacement, the cookie replacement, and the script addition are performed to the browser 30 (Step S106). Then, the browser 30 creates an iframe with the added script (step S107). Here, since the ancestor domain of sso.example.com is only one of example.com and the path is / login / login, the URI of the created iframe is http: //http-example-com.r .test / login / CookieHandler.html

そして、中継サーバ10のリクエスト判別部11は、URI「http://http-example-com.r.test/login/CookieHandler.html」でのリクエストをブラウザ30のiframeから受信する(ステップS108)。そして、リクエスト判別部11は、パスのファイル名がCookieHandler.htmlであることからクッキー操作ページ返却部13に処理を割り振る。続いて、クッキー操作ページ返却部13は、クッキー操作ページをクライアントに返信する(ステップS109)。   Then, the request determination unit 11 of the relay server 10 receives the request with the URI “http: //http-example-com.r.test/login/CookieHandler.html” from the iframe of the browser 30 (step S108). Then, the request determination unit 11 assigns a process to the cookie operation page return unit 13 because the file name of the path is CookieHandler.html. Subsequently, the cookie operation page return unit 13 returns a cookie operation page to the client (step S109).

その後、ブラウザ30側でsetCookieFunc関数が呼び出されると、指定されてあるドメインの.example.comに対応するiframeのhttp://http-example-com.r.test/login/CookieHandler.htmlに対してクロスドメイン通信でクッキーセット要求を送る(ステップS110)。そして、クロスドメイン通信を受けたiframeは、クロスドメインの通信元の妥当性をチェックする。図4の例では、送信元のドメインがhttp-sso-example-com.r.testであり、iframeのドメインがhttp-example-com.r.testとなっており、置換前のドメインでは親子関係であるため妥当であると判断する。妥当であると判断された場合には、iframe側では、document.cookie=“sid=1234;path=/”のスクリプトを実行しクッキーのセットを行う(ステップS111)。   After that, when the setCookieFunc function is called on the browser 30 side, for http: //http-example-com.r.test/login/CookieHandler.html of iframe corresponding to .example.com of the specified domain A cookie set request is sent by cross-domain communication (step S110). Then, the iframe that has received the cross domain communication checks the validity of the cross domain communication source. In the example of Fig. 4, the source domain is http-sso-example-com.r.test, the iframe domain is http-example-com.r.test, and the parent-child relationship in the domain before replacement Therefore, it is judged to be appropriate. If it is determined to be valid, the iframe side executes a script of document.cookie = “sid = 1234; path = /” to set a cookie (step S111).

次に、図5を用いて、実施例1に係る中継サーバ10によるクッキー読み取り処理を説明する。図5は、実施例1に係る中継サーバ装置によるクッキー読み取り処理の流れを示すシーケンス図である。以下の例では、図4で説明したログイン処理の後でアプリケーションのapp1を利用した場合について説明する。app1では、http://app1.example.com/sso/にアクセスすると、SSO認証が行われるものとする。   Next, a cookie reading process by the relay server 10 according to the first embodiment will be described with reference to FIG. FIG. 5 is a sequence diagram illustrating the flow of the cookie reading process performed by the relay server device according to the first embodiment. In the following example, a case where application app1 is used after the login process described with reference to FIG. 4 will be described. When app1 accesses http://app1.example.com/sso/, SSO authentication is performed.

図5に示すように、ブラウザ30は、中継サーバ10経由でhttp://app1.example.com/にアクセスして、http://http-app1-example-com.r.test/にリクエストを送る(ステップS201)。そして、中継サーバ10のリクエスト判別部11は、パス部分の/がCookieHandler.htmlと異なるため、中継部12へリクエスト処理を割り振る。   As shown in FIG. 5, the browser 30 accesses http://app1.example.com/ via the relay server 10 and makes a request to http: //http-app1-example-com.r.test/. Send (step S201). The request determination unit 11 of the relay server 10 allocates request processing to the relay unit 12 because / in the path part is different from CookieHandler.html.

そして、中継部12のURI置換部12bは、URIをhttp://app1.example.com/に復元する(ステップS202)。続いて、リクエスト代行部12aは、復元されたURIに対しリクエストを送ると(ステップS203)、Webサーバ20からレスポンスを受信する(ステップS204)。   Then, the URI replacement unit 12b of the relay unit 12 restores the URI to http://app1.example.com/ (step S202). Subsequently, when the request proxy unit 12a sends a request to the restored URI (step S203), the request proxy unit 12a receives a response from the Web server 20 (step S204).

そして、中継サーバ10は、Webサーバ20から返ってきたレスポンスに対してURI置換、クッキー置換、スクリプト追加を行う(ステップS205)。ここでは、レスポンスにはSet-Cookieヘッダやスクリプト中のdocument.cookieへの代入が含まれていないので、クッキー置換を行わない。その後、中継サーバ10は、レスポンスをブラウザ30に送信する(ステップS206)。   Then, the relay server 10 performs URI replacement, cookie replacement, and script addition on the response returned from the Web server 20 (step S205). Here, since the response does not include the Set-Cookie header or assignment to document.cookie in the script, cookie substitution is not performed. Thereafter, the relay server 10 transmits a response to the browser 30 (step S206).

そして、ブラウザ30は、追加されたスクリプトでiframeを作成する(ステップS207)。app1.example.comの祖先ドメインは、「example.com」の一つだけであり、パスが「/」であるため、作成されるiframeのURIがhttp://http-example-com.r.test/CookieHandler.htmlとなる。そして、ブラウザ内のiframeは、このURIでのリクエストを中継サーバ10に送信して、/CookieHandler.htmlを読み込む(ステップS208)。   Then, the browser 30 creates an iframe with the added script (step S207). Since the ancestor domain of app1.example.com is only one of “example.com” and the path is “/”, the URI of the created iframe is http: //http-example-com.r. It becomes test / CookieHandler.html. Then, the iframe in the browser transmits a request with this URI to the relay server 10 and reads /CookieHandler.html (step S208).

そして、リクエスト判別部11は、パスが/CookieHandler.htmlであるので、クッキー操作ページ返却部13に処理を割り振る。クッキー操作ページ返却部13は、クッキー操作ページをクライアントに返却する(ステップS209)。続いて、ブラウザの親フレームがiframeに対してクロスドメイン通信でクッキーの取得要求を出す(ステップS210)。iframe側では、クロスドメイン通信の通信元がiframeのドメインの子孫ドメインであることを確認し、document.cookieプロパティを参照してブラウザ30がhttp-example.com.r.testドメインの/パスで保存しているクッキーを読み取る(ステップS211)。例えば、document.cookieを参照することでsid=1234のクッキーを読み取る。   Then, since the path is /CookieHandler.html, the request determination unit 11 allocates processing to the cookie operation page return unit 13. The cookie operation page return unit 13 returns the cookie operation page to the client (step S209). Subsequently, the parent frame of the browser issues a cookie acquisition request to the iframe by cross-domain communication (step S210). On the iframe side, confirm that the source of cross-domain communication is a descendant domain of the iframe domain, refer to the document.cookie property, and save the browser 30 in the / path of the http-example.com.r.test domain The cookie being read is read (step S211). For example, the cookie with sid = 1234 is read by referring to document.cookie.

そして、iframeは、読み取ったクッキーをクロスドメイン通信で親フレームのhttp://http-app1-example-com.r.test/に送信する(ステップS212)。親フレームでは、クロスドメイン通信の通信元が祖先ドメインであるかを確認して、document.cookieプロパティにクッキーの内容を代入する(ステップS213)。これにより、親フレームのドメインで祖先ドメインのクッキーが読めるようになる。また、クッキーの一貫性のためにタイマー等でステップS210〜S213を繰り返し実行する。   The iframe transmits the read cookie to the parent frame http: //http-app1-example-com.r.test/ by cross-domain communication (step S212). In the parent frame, it is confirmed whether the communication source of the cross domain communication is an ancestor domain, and the contents of the cookie are substituted into the document.cookie property (step S213). This allows the ancestor domain cookies to be read in the parent frame domain. Further, for the consistency of cookies, steps S210 to S213 are repeatedly executed by a timer or the like.

そして、ユーザがブラウザ30上に表示されているSSOのためのリンクをクリックすると(ステップS214)、ブラウザ30は、http://http-app1-example-com.r.test/sso/にリクエストを送ろうとする(ステップS215)。ここでは、祖先ドメインのクッキーがコピーされているため、ブラウザ30は、クッキーとしてCookie:sid=1234を付与してリクエストを送る。   When the user clicks the link for SSO displayed on the browser 30 (step S214), the browser 30 sends a request to http: //http-app1-example-com.r.test/sso/. Try to send (step S215). Here, since the cookie of the ancestor domain is copied, the browser 30 sends a request with Cookie: sid = 1234 assigned as the cookie.

中継サーバ10のリクエスト判別部11は、リクエストを受信するとき、パスが/sso/であり、/CookieHandler.htmlでないので、中継部12にリクエスト処理を割り振る。中継部12のURI置換部12bがURIをhttp://app1.example.com/sso/と復元し(ステップS216)、リクエスト代行部12aがCookie: sid=1234のヘッダがついたリクエストをhttp://app1.example.com/sso/に送信する(ステップS217)。その後、Webサーバ20では、クッキーのsidの値を見てSSO認証を行うことになる。これによってドメインをまたがったSSO認証が中継サーバ10を介しても正常に行われることになる。   When receiving a request, the request determination unit 11 of the relay server 10 allocates request processing to the relay unit 12 because the path is / sso / and not /CookieHandler.html. The URI replacement unit 12b of the relay unit 12 restores the URI to http://app1.example.com/sso/ (step S216), and the request proxy unit 12a sends a request with a header of Cookie: sid = 1234 to http: // Send to app1.example.com/sso/ (step S217). Thereafter, the Web server 20 performs SSO authentication by looking at the sid value of the cookie. As a result, SSO authentication across domains is normally performed even via the relay server 10.

[実施例1の効果]
上述してきたように、中継サーバ10は、Webサーバ20からブラウザ30に対するレスポンスを中継した場合に、リクエストのURIを置換する。そして、中継サーバ10は、Webサーバ20からブラウザ10に対するクッキー書き込み指示情報を受信した場合に、クッキー書き込み指示情報をスクリプトの呼び出し情報に置換する。その後、中継サーバ10は、置換されたスクリプトの呼び出し情報に対して、ブラウザ30のリクエスト先ドメインの祖先ドメインに対応するフレームを作成させるスクリプトを追加する。また、中継サーバ10は、フレームに祖先ドメインに対応するクッキーの書き込み指示をクロスドメイン通信で送信するスクリプトを追加する。このため、中継サーバを経由してブラウザからWebアプリケーションにアクセスする場合であっても、クッキー情報の書き込む処理を適切に実行することが可能である。
[Effect of Example 1]
As described above, when the relay server 10 relays a response from the Web server 20 to the browser 30, the relay of the request is replaced. When the relay server 10 receives cookie write instruction information for the browser 10 from the Web server 20, the relay server 10 replaces the cookie write instruction information with script call information. Thereafter, the relay server 10 adds a script for creating a frame corresponding to the ancestor domain of the request destination domain of the browser 30 to the replaced script call information. Further, the relay server 10 adds a script for transmitting a cookie write instruction corresponding to the ancestor domain to the frame by cross-domain communication. For this reason, even when accessing a Web application from a browser via a relay server, it is possible to appropriately execute a process of writing cookie information.

また、実施例1によれば、中継サーバ10は、祖先ドメインのフレームのパスのディレクトリをブラウザ30からのレスポンスの受信先フレームのパスのディレクトリと同じにさせるスクリプトをさらに追加する。このため、Set-CookieヘッダやJavaScript中のdocument.cookieへの代入でドメインやパスの指定がある場合にも、iframeのパスのディレクトリを親フレームのパスのディレクトリとそろえる。この結果、祖先ドメインおよび指定パスに該当するクッキー情報の書き込む処理を適切に実行することが可能である。   Further, according to the first embodiment, the relay server 10 further adds a script for making the directory path of the ancestor domain frame the same as the directory of the destination frame path of the response received from the browser 30. For this reason, even when a domain or path is specified by substitution in the Set-Cookie header or document.cookie in JavaScript, the iframe path directory is aligned with the parent frame path directory. As a result, it is possible to appropriately execute the process of writing the cookie information corresponding to the ancestor domain and the specified path.

また、実施例1によれば、中継サーバ10は、Webサーバ20からブラウザ30に対するレスポンスを受信する。そして、中継サーバ10は、祖先ドメインに対応するフレームを作成させるとともに該フレームに祖先ドメインのクッキーを取得させて該クッキーをレスポンスの受信先フレームにクロスドメイン通信で送信させるスクリプトを追加する。このため、クッキー情報の読み取り処理を適切に実行することが可能である。   According to the first embodiment, the relay server 10 receives a response from the Web server 20 to the browser 30. The relay server 10 adds a script that creates a frame corresponding to the ancestor domain, causes the frame to acquire a cookie of the ancestor domain, and transmits the cookie to the reception destination frame of the response by cross-domain communication. For this reason, it is possible to appropriately execute the cookie information reading process.

また、実施例1によれば、中継サーバ10は、祖先ドメインに対応するフレームに祖先ドメインのクッキーを取得させてクッキーをレスポンスの受信先フレームにクロスドメイン通信で送信させる処理を一定時間ごとに行わせるスクリプトを追加する。このため、祖先ドメインの一貫性を保つことが可能である。   Further, according to the first embodiment, the relay server 10 performs a process of acquiring a cookie of the ancestor domain in a frame corresponding to the ancestor domain and transmitting the cookie to the reception destination frame of the response by cross domain communication at regular intervals. Add the script to be used. For this reason, it is possible to maintain consistency of the ancestor domain.

ところで、上記の実施例1では、HTMLやJavaScriptにSet-Cookieヘッダが付いている場合に、スクリプトに変換してクッキーの読み書き処理を行う場合を説明したが、本実施例はこれに限定されるものではなく、画像などにSet-Cookieヘッダが付いている場合にも、クッキーの書き込み処理を行う。   By the way, in the above-described first embodiment, the case where HTML / JavaScript has a Set-Cookie header and converted to a script to perform cookie read / write processing has been described. However, the present embodiment is limited to this. Cookie write processing is performed even when a Set-Cookie header is attached to an image or the like.

例えば、ブラウザは、「http://www.example.com/image.jpg」を中継サーバ経由で読みこむために、図7に例示するようなHTTPのリクエストをWebサーバへ送信する。そして、Webサーバは、祖先ドメイン指定のあるクッキー「key=value;domain=.example.com;path=/」をヘッダに付けて、図8に例示するようなレスポンスを中継サーバ経由でブラウザに送信する。   For example, in order to read “http://www.example.com/image.jpg” via the relay server, the browser transmits an HTTP request as illustrated in FIG. 7 to the Web server. Then, the Web server adds a cookie “key = value; domain = .example.com; path = /” with an ancestor domain designation to the header, and sends a response as illustrated in FIG. 8 to the browser via the relay server. To do.

まず最初に、実施例2に係る中継サーバ10Aの構成を説明する。図6に示すように、中継サーバ10Aは、図1に示した中継サーバ10と比較して、画像クッキー処理部14を新たに有する点が相違する。かかる中継サーバ10Aにおいて、画像クッキー処理部14は、URI置換部14a、レスポンス作成部14b、一時保管部14cを有する。   First, the configuration of the relay server 10A according to the second embodiment will be described. As illustrated in FIG. 6, the relay server 10 </ b> A is different from the relay server 10 illustrated in FIG. 1 in that it newly includes an image cookie processing unit 14. In the relay server 10A, the image cookie processing unit 14 includes a URI replacement unit 14a, a response creation unit 14b, and a temporary storage unit 14c.

リクエスト判別部11は、実施例1と同様に、リクエストのパスが「/CookieHandler.html」や「/dir1/dir2/CookieHandler.html」となっているリクエストについては、クッキー操作ページ返却部13にリクエストを通知する。また、リクエスト判別部11は、実施例1と同様に、リクエストのパスが「/」や「/CookieHandler.html/dir/」となっているリクエストについては、中継部12へリクエストを通知する。また、リクエスト判別部11は、URIのクエリパラメータにSetCookieWithRedirection=trueを含んでいるリクエストについては、画像クッキー処理部14にリクエストを通知する。   As in the first embodiment, the request determination unit 11 requests the cookie operation page return unit 13 for requests whose request path is “/CookieHandler.html” or “/dir1/dir2/CookieHandler.html”. To be notified. Similarly to the first embodiment, the request determination unit 11 notifies the relay unit 12 of a request for a request whose request path is “/” or “/CookieHandler.html/dir/”. In addition, the request determination unit 11 notifies the image cookie processing unit 14 of a request that includes SetCookieWithRedirection = true in the URI query parameter.

URI置換部14aは、Webサーバ20から受信したURIのドメイン部分を置換し、ブラウザ30から受信したURIのドメイン部を復元する。具体的には、URI置換部14aは、Webサーバ20から受信したURIのドメイン部分のドット「.」をハイフン「-」に置換するとともに、中継サーバのホスト名「r.test」を付加する。   The URI replacement unit 14 a replaces the domain part of the URI received from the Web server 20 and restores the domain part of the URI received from the browser 30. Specifically, the URI replacement unit 14a replaces the dot “.” In the domain portion of the URI received from the Web server 20 with a hyphen “-” and adds the host name “r.test” of the relay server.

レスポンス作成部14bは、クッキー書き込み指示情報に含まれるクッキーを書き込んだ格納先であるURIをリダイレクト先としてブラウザ30に送信する。具体的には、レスポンス作成部14bは、データベースに格納されているcookiesの中から任意のクッキーを一つ取得し、このクッキーをセットできるURIへのリダイレクトをブラウザに送信する。   The response creation unit 14b transmits the URI, which is the storage destination in which the cookie included in the cookie write instruction information is written, to the browser 30 as a redirect destination. Specifically, the response creation unit 14b acquires one arbitrary cookie from cookies stored in the database, and transmits a redirect to a URI that can set the cookie to the browser.

そして、レスポンス作成部14bは、ブラウザ30からリダイレクト先に対するリクエストがあった場合には、クッキーをブラウザ30に送信するとともに、リダイレクト先に再度リクエストさせるレスポンスを作成する。そして、レスポンス作成部14bは、ブラウザ30からリダイレクト先に対するリクエストが再度あった場合には、一時保管部14cに格納されたレスポンスボディをブラウザ30に返信する。   Then, when there is a request for the redirect destination from the browser 30, the response creating unit 14 b creates a response that sends the cookie to the browser 30 and requests the redirect destination again. The response creation unit 14b returns the response body stored in the temporary storage unit 14c to the browser 30 when there is a request for the redirect destination from the browser 30 again.

一時保管部14cは、サーバからブラウザに対するレスポンスに含まれるレスポンスボディがHTMLやJavaScriptではなく、祖先ドメイン指定のあるクッキー書き込み指示情報が含まれている場合に、クッキー書き込み指示情報に含まれるクッキーおよびレスポンスボディを記憶する。   The temporary storage unit 14c, when the response body included in the response from the server to the browser is not HTML or JavaScript, but includes cookie write instruction information with an ancestor domain specification, the cookie and response included in the cookie write instruction information Memorize the body.

具体的には、一時保管部14cは、図9に示すように、一意に割り当てられた値である「id」、乱数によって生成された値である「token」、後述する図10のresp1rのSet-Cookieヘッダのうち祖先ドメインのドメイン指定のあるクッキーである「cookies」を対応付けて記憶する。また、一時保管部14cは、図9に示すように、画像データのレスポンスボディである「respBody」、ブラウザ30からWebサーバ20へのリクエストのURIを復元したURIである「returnTo」を対応付けて記憶する。   Specifically, the temporary storage unit 14c, as shown in FIG. 9, “id”, which is a uniquely assigned value, “token”, which is a value generated by a random number, and the set of resp1r in FIG. -"Cookies", which is a cookie with an ancestor domain specified in the Cookie header, is stored in association with each other. Further, as illustrated in FIG. 9, the temporary storage unit 14 c associates “respBody” that is a response body of image data with “returnTo” that is a URI obtained by restoring the URI of the request from the browser 30 to the Web server 20. Remember.

次に、図10〜図12を用いて、実施例2に係る中継サーバ10Aによる処理を説明する。図10は、実施例2に係る中継サーバ装置による画像クッキー処理の流れを示すシーケンス図である。図11は、実施例2に係る中継サーバ装置による処理の流れを示すフローチャートである。図12は、実施例2に係る中継サーバ装置による処理の流れを示すフローチャートである。   Next, processing performed by the relay server 10A according to the second embodiment will be described with reference to FIGS. FIG. 10 is a sequence diagram illustrating the flow of the image cookie process performed by the relay server device according to the second embodiment. FIG. 11 is a flowchart illustrating a process flow of the relay server device according to the second embodiment. FIG. 12 is a flowchart illustrating a process flow of the relay server device according to the second embodiment.

図10に示すように、ブラウザ30がhttp://www.example.com/image.jpgを中継サーバ経由で読み込むためにhttp://http-www-example-com.r.test/image.jpgにリクエストを送る(ステップS301)。そして、中継サーバ10Aは、リクエストを中継してhttp://www.example.com/image.jpgにリクエストを送る(ステップS302)。   As shown in FIG. 10, in order for the browser 30 to read http://www.example.com/image.jpg via a relay server, http: //http-www-example-com.r.test/image.jpg A request is sent to (step S301). Then, the relay server 10A relays the request and sends the request to http://www.example.com/image.jpg (step S302).

そして、Webサーバ20は,祖先ドメイン指定のあるクッキーkey=value;domain=.example.com;path=/をヘッダにつけて画像データを返す(ステップS303)。そして、中継サーバ10Aは、HTMLかJavaScriptのクッキーセット指示でなくて、かつ、祖先ドメイン指定があると判定した場合には、中継部12から画像クッキー処理部14に処理を委譲する。そして、画像クッキー処理部14では、一時保管部14cに対して新たな行を追加して、データを書き込む(ステップS304)。   Then, the Web server 20 adds the cookie key = value; domain = .example.com; path = / with the ancestor domain designation to the header and returns the image data (step S303). When the relay server 10A determines that there is no HTML or JavaScript cookie set instruction and there is an ancestor domain designation, the relay server 10A delegates the processing to the image cookie processing unit 14. Then, the image cookie processing unit 14 adds a new line to the temporary storage unit 14c and writes the data (step S304).

その後、レスポンス作成部14bは、一時保管部14cに格納されているcookiesの中から任意のクッキーを一つ取り出す。例えば、図9の例では、cookiesカラムにはクッキーが一つしか格納されていないため、key=value;domain=.example.com; path=/が取り出される。中継サーバ10は、取り出されたクッキーをセットできるURIであるhttp://http-example-com.r.test/?SetCookieWithRedirection=true&id=1234&token=0306へのリダイレクトをブラウザ30に返す(ステップS305)。なお、このURIでSetCookieWithRedirection=trueというクエリパラメータは、実施例1に登場したCookieHandler.htmlと同様に中継サーバが任意に設定できるものである。また、idとtokenのパラメータ名も中継サーバが自由に設定できる。   Thereafter, the response creation unit 14b takes out one arbitrary cookie from the cookies stored in the temporary storage unit 14c. For example, in the example of FIG. 9, since only one cookie is stored in the cookies column, key = value; domain = .example.com; path = / is extracted. The relay server 10 returns to the browser 30 a redirect to http: //http-example-com.r.test/? SetCookieWithRedirection = true & id = 1234 & token = 0306, which is a URI that can set the extracted cookie (step S305). Note that the query parameter SetCookieWithRedirection = true in this URI can be arbitrarily set by the relay server in the same way as CookieHandler.html that appeared in the first embodiment. Also, the relay server can freely set the parameter names of id and token.

ブラウザ30は、http://http-example-com.r.test/?SetCookieWithRedirection=true&id=1234&token=0306にリクエストを送り直す(ステップS306)。中継サーバ10のリクエスト判別部11は、リクエストされたURIのクエリパラメータにSetCookieWithRedirection=trueを含んでいるため画像クッキー処理部14のレスポンス作成部14bに処理を渡す。   The browser 30 resends the request to http: //http-example-com.r.test/? SetCookieWithRedirection = true & id = 1234 & token = 0306 (step S306). Since the request determination unit 11 of the relay server 10 includes SetCookieWithRedirection = true in the query parameter of the requested URI, the request determination unit 11 passes the processing to the response creation unit 14b of the image cookie processing unit 14.

レスポンス作成部14bは、リクエストのidパラメータとtokenパラメータを取得し両者が一致する行を一時保管部14cから取得する。ステップS306において送信されたリクエストのURIを復元した時のドメインとパスは、example.comと/であり、このドメインとパスで設定することのできるクッキーをcookiesカラムから探すとkey=value;domain=.example.com;path=/が合致する。このため、レスポンス作成部14bは、このクッキーを一時保管部14cから取得してから削除する(ステップS307)。   The response creation unit 14b acquires the id parameter and the token parameter of the request, and acquires a line in which both match from the temporary storage unit 14c. When the URI of the request transmitted in step S306 is restored, the domain and path are example.com and /. When a cookie that can be set with this domain and path is searched from the cookies column, key = value; domain = .example.com; path = / matches. For this reason, the response creation unit 14b deletes the cookie after acquiring it from the temporary storage unit 14c (step S307).

そして、中継サーバ10のレスポンス作成部14bは、cookiesカラムに残っているクッキーがなくなったので、returnToカラムの値をURI置換してクエリパラメータを追加する。そして、取得したクッキーをヘッダにつけてURIへのリダイレクトをブラウザに返す(ステップS308)。その後、ブラウザ30は、Set-Cookie:key=value;domain=.http-www-example-com.r.test;path=/のヘッダに従ってexample.comを置換したhttp-www-example-com.r.testドメインでのクッキーセットを行う。   Then, the response creation unit 14b of the relay server 10 adds a query parameter by replacing the value of the returnTo column with a URI because there is no cookie remaining in the cookies column. Then, the acquired cookie is attached to the header and a redirect to the URI is returned to the browser (step S308). Thereafter, the browser 30 replaces example.com according to the header of Set-Cookie: key = value; domain = .http-www-example-com.r.test; path = / http-www-example-com.r Set cookies in the .test domain.

そして、ブラウザ30は、ステップS308で指示されているURIでリクエストを送り直す(ステップS309)。そして、中継サーバ10のリクエスト判別部11は、リクエストパラメータにSetCookieWithRedirection=trueがあるため画像クッキー処理部14に処理を渡す。   Then, the browser 30 resends the request with the URI specified in step S308 (step S309). Then, the request determination unit 11 of the relay server 10 passes the processing to the image cookie processing unit 14 because the request parameter includes SetCookieWithRedirection = true.

レスポンス作成部14は、リクエストのidパラメータとtokenパラメータを取得し両者が一致する行を一時保管部14cから取得する。ステップS307においてcookiesカラムが空になっているため、respBodyの値を取得し、一時保管部14cから当該行を削除する(ステップS310)。その後、レスポンス作成部14は、respBodyでレスポンスを作成してブラウザ30に返す(ステップS311)。   The response creation unit 14 acquires the id parameter and the token parameter of the request, and acquires a row in which both match from the temporary storage unit 14c. Since the cookies column is empty in step S307, the value of respBody is acquired and the row is deleted from the temporary storage unit 14c (step S310). Thereafter, the response creation unit 14 creates a response with respBody and returns it to the browser 30 (step S311).

次に、図11および図12を用いて、実施例2に係る中継サーバによる処理の流れを説明する。図11および図12は、実施例2に係る中継サーバ装置による処理の流れを示すフローチャートである。図11に示すように、中継サーバ10Aは、レスポンスを受信すると(ステップS401肯定)、Webサーバ20からのレスポンスがHTMLまたはJavascriptであるか判定する(ステップS402)。   Next, the flow of processing by the relay server according to the second embodiment will be described with reference to FIGS. 11 and 12. FIG. 11 and FIG. 12 are flowcharts illustrating the flow of processing by the relay server device according to the second embodiment. As illustrated in FIG. 11, when the relay server 10A receives the response (Yes at Step S401), the relay server 10A determines whether the response from the Web server 20 is HTML or JavaScript (Step S402).

この結果、中継サーバ装置10Aは、レスポンスがHTMLまたはJavascriptであると判定した場合には(ステップS402肯定)、実施例1で説明したように、クッキーセット指示をsetCookieFunc関数の呼び出しに置換する(ステップS403)。そして、中継サーバ装置10Aは、レスポンスにSet-Cookieヘッダやdocument.cookieへの代入が含まれておらず(ステップS402否定)、Set-Cookieヘッダが付いている場合には、ドメイン指定があるか判定する(ステップS404)。   As a result, when the relay server apparatus 10A determines that the response is HTML or Javascript (Yes in step S402), as described in the first embodiment, the relay server apparatus 10A replaces the cookie set instruction with a call to the setCookieFunc function (step S402). S403). Then, the relay server device 10A does not include the assignment to the Set-Cookie header or document.cookie in the response (No in step S402), and if there is a Set-Cookie header, is there a domain designation? Determination is made (step S404).

この結果、中継サーバ装置10Aは、祖先ドメインの指定がある場合には(ステップS404肯定)、クッキー読み取り処理と行削除処理(後に、図12を用いて詳述)を行う(ステップS405)。また、中継サーバ装置10Aは、祖先ドメインの指定がない場合には(ステップS404否定)、ヘッダにもともとついていたクッキーのドメインを置換する(ステップS406)。   As a result, when the ancestor domain is designated (Yes at Step S404), the relay server device 10A performs a cookie reading process and a line deletion process (described later in detail with reference to FIG. 12) (Step S405). If there is no ancestor domain designation (No at Step S404), the relay server device 10A replaces the cookie domain that was originally included in the header (Step S406).

次に、図12を用いて、中継サーバ10Aによるクッキー読み取り処理と行削除処理について説明する。図12に示すように、同一ドメインのクッキーをレスポンスヘッダに追加し(ステップS501)、一時保管部14cに対して新たな行を作成する(ステップS502)。   Next, cookie reading processing and line deletion processing by the relay server 10A will be described using FIG. As shown in FIG. 12, a cookie of the same domain is added to the response header (step S501), and a new line is created for the temporary storage unit 14c (step S502).

そして、中継サーバ10Aのレスポンス作成部14bは、一時保管部14cのcookiesカラムにクッキーがあるか判定する(ステップS503)。この結果、レスポンス作成部14bは、一時保管部14cのcookiesカラムにクッキーがある場合には(ステップS503肯定)、cookiesカラムからクッキーを一つ取得する(ステップS504)。そして、取得したクッキーをセットできるURIにリダイレクトをブラウザ30に送信する(ステップS505)。   Then, the response creation unit 14b of the relay server 10A determines whether there is a cookie in the cookies column of the temporary storage unit 14c (step S503). As a result, when there is a cookie in the cookies column of the temporary storage unit 14c (Yes at Step S503), the response creation unit 14b acquires one cookie from the cookies column (Step S504). Then, the redirect is transmitted to the browser 30 to the URI that can set the acquired cookie (step S505).

その後、中継サーバ10Aは、次のリクエストを待った後(ステップS506)、cookiesカラムにあるクッキーのうち現在のURIでセットできるクッキーをすべて取得し、当該クッキーをカラムから削除してレスポンスヘッダに追加する(ステップS507)。そして、ステップS503に戻って、一時保管部14cのcookiesカラムにクッキーがなくなるまでステップS504〜S507の処理を繰り返す。その後、一時保管部14cのcookiesカラムにクッキーがなくなると(ステップS503否定)、returnToカラムの値を取得する(ステップS508)。   Thereafter, after waiting for the next request (step S506), the relay server 10A acquires all cookies that can be set with the current URI from among the cookies in the cookies column, deletes the cookies from the column, and adds them to the response header. (Step S507). And it returns to step S503 and repeats the process of step S504-S507 until there is no cookie in the cookies column of the temporary storage part 14c. Thereafter, when there is no cookie in the cookies column of the temporary storage unit 14c (No at Step S503), the value of the returnTo column is acquired (Step S508).

そして、取得したクッキーをヘッダにつけてURIへのリダイレクトをブラウザに返す(ステップS509)。その後、中継サーバ10は、リクエストを待った後(ステップS510)、リクエストのidパラメータとtokenパラメータを取得して両者が一致する行を一時保管部14cから取得してrespBodyの値を読み出し、当該行を削除する(ステップS511)。   Then, the acquired cookie is attached to the header and a redirect to the URI is returned to the browser (step S509). Thereafter, the relay server 10 waits for the request (step S510), acquires the id parameter and the token parameter of the request, acquires a line in which both match from the temporary storage unit 14c, reads the value of respBody, and reads the line. It deletes (step S511).

このように実施例2によれば、中継サーバ10Aは、Webサーバ20からブラウザ30に対するレスポンスに含まれるレスポンスボディがHTMLかJavaScriptではなくクッキー書き込み指示情報が含まれている場合に、クッキー書き込み指示情報に含まれるクッキーおよびレスポンスボディを一時保管部14cに格納する。そして、中継サーバ10Aは、クッキー書き込み指示情報に含まれるクッキーを書き込んだURIをリダイレクト先としてブラウザ30に送信する。続いて、中継サーバ10Aは、ブラウザ30からリダイレクト先に対するリクエストがあった場合には、クッキーをブラウザ30に送信するとともに、リダイレクト先に再度リクエストさせるレスポンスを作成する。その後、中継サーバ10Aは、ブラウザ30からリダイレクト先に対するリクエストが再度あった場合には、一時保管部14cに格納されたレスポンスボディをブラウザ30に返信する。このため、中継サーバ10Aは、画像などにSet-Cookieが付いている場合であっても、ブラウザ30にクッキーを適切に処理させることが可能となる。   As described above, according to the second embodiment, when the response body included in the response from the Web server 20 to the browser 30 includes cookie writing instruction information instead of HTML or JavaScript, the relay server 10A includes cookie writing instruction information. Are stored in the temporary storage unit 14c. Then, the relay server 10A transmits the URI in which the cookie included in the cookie write instruction information is written to the browser 30 as a redirect destination. Subsequently, when there is a request for a redirect destination from the browser 30, the relay server 10 </ b> A transmits a cookie to the browser 30 and creates a response that requests the redirect destination again. Thereafter, when the request for the redirect destination is received again from the browser 30, the relay server 10 </ b> A returns the response body stored in the temporary storage unit 14 c to the browser 30. For this reason, the relay server 10A can cause the browser 30 to appropriately process the cookie even if the image includes a Set-Cookie.

さて、これまで実施例1、2について説明したが、上述した実施例以外にも、種々の異なる形態にて実施されてよいものである。そこで、以下では実施例3として他の実施例を説明する。   Although the first and second embodiments have been described so far, the present invention may be implemented in various different forms other than the above-described embodiments. Therefore, another embodiment will be described below as a third embodiment.

(1)システム構成等
また、図示した各装置の各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。すなわち、各装置の分散・統合の具体的形態は図示のものに限られず、その全部または一部を、各種の負荷や使用状況などに応じて、任意の単位で機能的または物理的に分散・統合して構成することができる。例えば、スクリプト追加部12dを書込スクリプト追加部と読取スクリプト追加部とに分散してもよい。さらに、各装置にて行なわれる各処理機能は、その全部または任意の一部が、CPUおよび当該CPUにて解析実行されるプログラムにて実現され、あるいは、ワイヤードロジックによるハードウェアとして実現され得る。
(1) System Configuration, etc. Further, each component of each illustrated apparatus is functionally conceptual and does not necessarily need to be physically configured as illustrated. In other words, the specific form of distribution / integration of each device is not limited to that shown in the figure, and all or a part thereof may be functionally or physically distributed or arbitrarily distributed in arbitrary units according to various loads or usage conditions. Can be integrated and configured. For example, the script adding unit 12d may be distributed into a writing script adding unit and a reading script adding unit. Further, all or any part of each processing function performed in each device may be realized by a CPU and a program analyzed and executed by the CPU, or may be realized as hardware by wired logic.

(2)プログラム
図1の中継サーバ10の処理をプログラムにより実行する場合、図13に示すような情報処理装置(コンピュータ)が用いられる。図13の情報処理装置は、Central Processing Unit(CPU)1401、メモリ1402、入力装置1403、出力装置1404、外部記憶装置1405、媒体駆動装置1406、およびネットワーク接続装置1407を有し、互いに接続されている。
(2) Program When the processing of the relay server 10 in FIG. 1 is executed by a program, an information processing apparatus (computer) as shown in FIG. 13 is used. 13 includes a central processing unit (CPU) 1401, a memory 1402, an input device 1403, an output device 1404, an external storage device 1405, a medium driving device 1406, and a network connection device 1407, which are connected to each other. Yes.

メモリ1402は、例えば、Read Only Memory(ROM)、Random Access Memory(RAM)等を含み、処理に用いられるプログラムおよびデータを格納する。CPU1401は、メモリ1402を利用してプログラムを実行することにより、中継サーバと同様の処理を行う。   The memory 1402 includes, for example, a read only memory (ROM), a random access memory (RAM), and the like, and stores programs and data used for processing. The CPU 1401 performs the same processing as the relay server by executing a program using the memory 1402.

入力装置1403は、例えば、キーボード、ポインティングデバイス等であり、オペレータからの指示や情報の入力に用いられる。出力装置1404は、例えば、ディスプレイ、プリンタ、スピーカ等であり、オペレータへの問い合わせや処理結果の出力に用いられる。   The input device 1403 is, for example, a keyboard, a pointing device, and the like, and is used for inputting instructions and information from an operator. The output device 1404 is, for example, a display, a printer, a speaker, or the like, and is used for outputting an inquiry to the operator and a processing result.

外部記憶装置1405は、例えば、磁気ディスク装置、光ディスク装置、光磁気ディスク装置、テープ装置等である。情報処理装置は、この外部記憶装置1405に、プログラムおよびデータを格納しておき、必要に応じて、それらをメモリ1402にロードして使用する。   The external storage device 1405 is, for example, a magnetic disk device, an optical disk device, a magneto-optical disk device, a tape device, or the like. The information processing apparatus stores programs and data in the external storage device 1405, and loads them into the memory 1402 for use as necessary.

媒体駆動装置1406は、可搬記録媒体1408を駆動し、その記録内容にアクセスする。可搬記録媒体1408は、メモリカード、フレキシブルディスク、光ディスク、光磁気ディスク等の任意のコンピュータ読み取り可能な記録媒体である。オペレータは、この可搬記録媒体1408にプログラムおよびデータを格納しておき、必要に応じて、それらをメモリ1402にロードして使用する。   The medium driving device 1406 drives a portable recording medium 1408 and accesses the recorded contents. The portable recording medium 1408 is an arbitrary computer-readable recording medium such as a memory card, a flexible disk, an optical disk, and a magneto-optical disk. The operator stores programs and data in the portable recording medium 1408, and loads them into the memory 1402 for use as necessary.

ネットワーク接続装置1407は、インターネット等の通信ネットワークに接続され、クライアント及び各目的サーバとの通信に伴うデータ変換を行う。また、情報処理装置は、必要に応じて、プログラムおよびデータを外部の装置からネットワーク接続装置1407を介して受け取り、それらをメモリ1402にロードして使用する。   The network connection device 1407 is connected to a communication network such as the Internet, and performs data conversion accompanying communication with the client and each target server. Further, the information processing apparatus receives programs and data from an external apparatus via the network connection apparatus 1407 as necessary, and loads them into the memory 1402 for use.

10、10A 中継サーバ
11 リクエスト判別部
12 中継部
12a リクエスト代行部
12b URI置換部
12c クッキー置換部
12d スクリプト追加部
13 クッキー操作ページ返却部
14 画像クッキー処理部
14a URI置換部
14b レスポンス作成部
14c 一時保管部
10, 10A relay server 11 request determination unit 12 relay unit 12a request proxy unit 12b URI replacement unit 12c cookie replacement unit 12d script addition unit 13 cookie operation page return unit 14 image cookie processing unit 14a URI replacement unit 14b response creation unit 14c temporary storage Part

Claims (7)

サーバからブラウザに対するレスポンスを中継した場合に、該リクエストの資源識別子を置換する資源識別子置換部と、
前記サーバから前記ブラウザに対するクッキー書き込み指示情報を受信した場合に、該クッキー書き込み指示情報をスクリプトの呼び出し情報に置換するクッキー置換部と、
前記クッキー置換部によって置換されたスクリプトの呼び出し情報に対して、前記ブラウザのリクエスト先ドメインの祖先ドメインに対応するフレームを作成させるとともに祖先ドメインに対応するクッキーの書き込み指示をクロスドメイン通信で前記フレームへ送信させるスクリプトを追加する書込スクリプト追加部と、
を有することを特徴とする中継サーバ装置。
A resource identifier replacement unit that replaces the resource identifier of the request when a response from the server to the browser is relayed;
A cookie replacement unit that replaces the cookie writing instruction information with script call information when receiving the cookie writing instruction information for the browser from the server;
For the script call information replaced by the cookie replacement unit, a frame corresponding to the ancestor domain of the request destination domain of the browser is created, and a cookie write instruction corresponding to the ancestor domain is transmitted to the frame by cross-domain communication. A writing script adding unit for adding a script to be transmitted;
A relay server device characterized by comprising:
前記書込スクリプト追加部は、前記祖先ドメインのフレームのパスのディレクトリを前記ブラウザからのレスポンスの受信先フレームのパスのディレクトリと同じにさせるスクリプトをさらに追加することを特徴とする請求項1に記載の中継サーバ装置。   2. The script according to claim 1, wherein the writing script adding unit further adds a script that makes a directory of a path of a frame of the ancestor domain the same as a directory of a path of a destination frame of a response from the browser. Relay server device. 前記祖先ドメインに対応するフレームを作成させるとともに該フレームに祖先ドメインのクッキーを読み取らせて該クッキーを前記レスポンスの受信先フレームにクロスドメイン通信で送信させるスクリプトを追加する読取スクリプト追加部をさらに有することを特徴とする請求項1または2に記載の中継サーバ装置。   A read script adding unit for creating a frame corresponding to the ancestor domain and adding a script for causing the frame to read a cookie of the ancestor domain and transmitting the cookie to the destination frame of the response by cross-domain communication; The relay server device according to claim 1, wherein 前記読取スクリプト追加部は、前記祖先ドメインに対応するフレームに祖先ドメインのクッキーを取得させて該クッキーを前記レスポンスの受信先フレームにクロスドメイン通信で送信させる処理を一定時間ごとに行わせるスクリプトを追加することを特徴とする請求項1〜3のいずれか一つに記載の中継サーバ装置。   The reading script adding unit adds a script that causes a cookie of an ancestor domain to be acquired in a frame corresponding to the ancestor domain and that the cookie is transmitted to the reception destination frame of the response by cross domain communication at regular intervals. The relay server device according to claim 1, wherein the relay server device is a relay server device. 前記サーバから前記ブラウザに対するレスポンスに含まれるレスポンスボディが画像情報であってクッキー書き込み指示情報が含まれている場合に、該クッキー書き込み指示情報に含まれるクッキーおよびレスポンスボディを記憶部に格納するクッキー格納部と、
前記クッキー書き込み指示情報に含まれるクッキーを書き込んだ格納先情報をリダイレクト先として前記ブラウザに送信するリダイレクト先送信部と、
前記ブラウザから前記リダイレクト先に対するリクエストがあった場合には、前記クッキーをブラウザに送信するとともに、前記リダイレクト先に再度リクエストさせるレスポンスを作成するレスポンス作成部と、
前記ブラウザから前記リダイレクト先に対するリクエストが再度あった場合には、前記記憶部に格納されたレスポンスボディを前記ブラウザに返信するレスポンスボディ返信部と、
をさらに有することを特徴とする請求項1〜4のいずれか一つに記載の中継サーバ装置。
When the response body included in the response from the server to the browser is image information and includes cookie write instruction information, the cookie storage stores the cookie and response body included in the cookie write instruction information in the storage unit And
A redirect destination transmission unit that transmits the storage destination information in which the cookie included in the cookie writing instruction information is written to the browser as a redirect destination;
When there is a request for the redirect destination from the browser, the cookie is transmitted to the browser, and a response creation unit that creates a response to request the redirect destination again;
When there is a request for the redirect destination from the browser again, a response body reply unit that returns the response body stored in the storage unit to the browser;
The relay server device according to claim 1, further comprising:
ブラウザからサーバに対するリクエストを受信した場合に、該リクエストの資源識別子を置換するURI置換ステップと、
前記サーバから前記ブラウザに対するクッキー書き込み指示情報を受信した場合に、該クッキー書き込み指示情報をスクリプトの呼び出し情報に置換するクッキー置換ステップと、
前記クッキー置換ステップによって置換されたスクリプトの呼び出し情報に対して、前記ブラウザのリクエスト先ドメインの祖先ドメインに対応するフレームを作成させるとともに該フレームに祖先ドメインに対応するクッキーの書き込み指示をクロスドメイン通信で送信するスクリプトを追加する書込スクリプト追加ステップと、
を含んだことを特徴とするクッキー制御方法。
A URI replacement step for replacing the resource identifier of the request when a request for the server is received from the browser;
A cookie replacement step of replacing the cookie write instruction information with script call information when receiving cookie write instruction information for the browser from the server;
For the script call information replaced by the cookie replacement step, a frame corresponding to the ancestor domain of the request destination domain of the browser is created and a cookie write instruction corresponding to the ancestor domain is transmitted to the frame by cross-domain communication. A writing script adding step for adding a script to be transmitted;
Cookie control method characterized by including.
ブラウザからサーバに対するリクエストを受信した場合に、該リクエストの資源識別子を置換するURI置換手順と、
前記サーバから前記ブラウザに対するクッキー書き込み指示情報を受信した場合に、該クッキー書き込み指示情報をスクリプトの呼び出し情報に置換するクッキー置換手順と、
前記クッキー置換手順によって置換されたスクリプトの呼び出し情報に対して、前記ブラウザのリクエスト先ドメインの祖先ドメインに対応するフレームを作成させるとともに該フレームに祖先ドメインに対応するクッキーの書き込み指示をクロスドメイン通信で送信するスクリプトを追加する書込スクリプト追加手順と、
をコンピュータに実行させることを特徴とするクッキー制御プログラム。
A URI replacement procedure for replacing the resource identifier of the request when a request for the server is received from the browser;
A cookie replacement procedure for replacing the cookie write instruction information with script call information when receiving cookie write instruction information for the browser from the server;
For the script call information replaced by the cookie replacement procedure, a frame corresponding to the ancestor domain of the request destination domain of the browser is created and a cookie write instruction corresponding to the ancestor domain is transmitted to the frame by cross-domain communication. Write script addition procedure to add the script to send,
A cookie control program for causing a computer to execute.
JP2010129428A 2010-06-04 2010-06-04 Relay server device, cookie control method, and cookie control program Expired - Fee Related JP5581820B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010129428A JP5581820B2 (en) 2010-06-04 2010-06-04 Relay server device, cookie control method, and cookie control program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010129428A JP5581820B2 (en) 2010-06-04 2010-06-04 Relay server device, cookie control method, and cookie control program

Publications (2)

Publication Number Publication Date
JP2011257810A true JP2011257810A (en) 2011-12-22
JP5581820B2 JP5581820B2 (en) 2014-09-03

Family

ID=45473964

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010129428A Expired - Fee Related JP5581820B2 (en) 2010-06-04 2010-06-04 Relay server device, cookie control method, and cookie control program

Country Status (1)

Country Link
JP (1) JP5581820B2 (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013109620A (en) * 2011-11-22 2013-06-06 Nippon Telegr & Teleph Corp <Ntt> Information system and authentication state management method thereof
CN104486458A (en) * 2014-12-15 2015-04-01 北京国双科技有限公司 Cross-domain session data processing method and device
JP2016509277A (en) * 2012-12-13 2016-03-24 クアルコム,インコーポレイテッド Loading a redirected web page in a web browser of a client device in a communication system
JP2016537696A (en) * 2013-09-20 2016-12-01 オラクル・インターナショナル・コーポレイション Web-based single sign-on with a formfill proxy application
JP2017504092A (en) * 2013-11-11 2017-02-02 アダロム・インコーポレイテッド Cloud service security broker and proxy
JP2017194843A (en) * 2016-04-20 2017-10-26 ヤフー株式会社 Transfer device, transfer method, and transfer program
US10324702B2 (en) 2014-09-12 2019-06-18 Microsoft Israel Research And Development (2002) Ltd. Cloud suffix proxy and a method thereof
RU2751436C1 (en) * 2020-10-14 2021-07-13 Общество С Ограниченной Ответственностью "Группа Айби" Method and system for dynamic global identification of user's environment
CN110209959B (en) * 2018-02-11 2024-01-12 北京京东尚科信息技术有限公司 Information processing method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004094805A (en) * 2002-09-03 2004-03-25 Internatl Business Mach Corp <Ibm> Network system, reverse proxy, computer device, deta processing method and program
JP2004318816A (en) * 2003-03-31 2004-11-11 Toshiba Corp Communication relay device, communication relay method, and program
JP2008242684A (en) * 2007-03-27 2008-10-09 Fujitsu Ltd Method and system for authentication processing
JP2009031852A (en) * 2007-07-24 2009-02-12 Yamaha Corp Relay device, relay method, and program
JP2009271676A (en) * 2008-05-02 2009-11-19 Fujitsu Ltd Web information relaying method and apparatus
JP2010079431A (en) * 2008-09-24 2010-04-08 Hitachi Software Eng Co Ltd Information leakage prevention program

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004094805A (en) * 2002-09-03 2004-03-25 Internatl Business Mach Corp <Ibm> Network system, reverse proxy, computer device, deta processing method and program
JP2004318816A (en) * 2003-03-31 2004-11-11 Toshiba Corp Communication relay device, communication relay method, and program
JP2008242684A (en) * 2007-03-27 2008-10-09 Fujitsu Ltd Method and system for authentication processing
JP2009031852A (en) * 2007-07-24 2009-02-12 Yamaha Corp Relay device, relay method, and program
JP2009271676A (en) * 2008-05-02 2009-11-19 Fujitsu Ltd Web information relaying method and apparatus
JP2010079431A (en) * 2008-09-24 2010-04-08 Hitachi Software Eng Co Ltd Information leakage prevention program

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013109620A (en) * 2011-11-22 2013-06-06 Nippon Telegr & Teleph Corp <Ntt> Information system and authentication state management method thereof
KR101756567B1 (en) 2012-12-13 2017-07-10 퀄컴 인코포레이티드 Loading a re-directed web page on a web browser of a client device in a communications system
JP2016509277A (en) * 2012-12-13 2016-03-24 クアルコム,インコーポレイテッド Loading a redirected web page in a web browser of a client device in a communication system
JP2016510445A (en) * 2012-12-13 2016-04-07 クアルコム,インコーポレイテッド Loading redirected web resources in a web browser on a client device in a communication system
US10693865B2 (en) 2013-09-20 2020-06-23 Oracle International Corporation Web-based interface integration for single sign-on
US10225244B2 (en) 2013-09-20 2019-03-05 Oracle International Corporation Web-based interface integration for single sign-on
JP2016537696A (en) * 2013-09-20 2016-12-01 オラクル・インターナショナル・コーポレイション Web-based single sign-on with a formfill proxy application
JP2017504092A (en) * 2013-11-11 2017-02-02 アダロム・インコーポレイテッド Cloud service security broker and proxy
US10324702B2 (en) 2014-09-12 2019-06-18 Microsoft Israel Research And Development (2002) Ltd. Cloud suffix proxy and a method thereof
US10642600B2 (en) 2014-09-12 2020-05-05 Microsoft Technology Licensing, Llc. Cloud suffix proxy and a method thereof
CN104486458A (en) * 2014-12-15 2015-04-01 北京国双科技有限公司 Cross-domain session data processing method and device
JP2017194843A (en) * 2016-04-20 2017-10-26 ヤフー株式会社 Transfer device, transfer method, and transfer program
CN110209959B (en) * 2018-02-11 2024-01-12 北京京东尚科信息技术有限公司 Information processing method and device
RU2751436C1 (en) * 2020-10-14 2021-07-13 Общество С Ограниченной Ответственностью "Группа Айби" Method and system for dynamic global identification of user's environment
US11218551B1 (en) 2020-10-14 2022-01-04 Group Ib, Ltd Method and system for user identification based on user environment

Also Published As

Publication number Publication date
JP5581820B2 (en) 2014-09-03

Similar Documents

Publication Publication Date Title
JP5581820B2 (en) Relay server device, cookie control method, and cookie control program
JP6323994B2 (en) Content management apparatus, content management method and program
JP2005321970A (en) Computer system
US20020032781A1 (en) Intermediary server apparatus and an information providing method
JP5437785B2 (en) Authentication method, conversion device, relay device, and program
JP2015219687A (en) Relay device, system, and program
JP2011013707A (en) Web page relay apparatus
JP2010102625A (en) Method and device for rewriting uniform resource locator
JP2017142619A (en) Api cooperation device, api cooperation method, and api cooperation program
JP2005346570A (en) Authentication system, authentication method and computer program
JP6197286B2 (en) Communication device, information processing system, and information processing system control method
KR20020017622A (en) Community service system in internet environment and method thereof
JP2009123062A (en) System and method for content display control
JP2008065814A (en) Information access control method
JP2012058898A (en) Web service providing system, server device, method and program
JP2001356983A (en) Information disclosure restriction system
JP2009251754A (en) Page customizing server, page customizing program, and page customizing method
JP2010039763A (en) Server system
US7835896B1 (en) Apparatus for evaluating and demonstrating electronic circuits and components
JP6413540B2 (en) Relay device, data processing system, and program
JP2002236662A (en) Information processing system and authentication server program
JP2014241113A (en) Content management device, content management system, content management method, and program
JP7119797B2 (en) Information processing device and information processing program
JP2007018383A (en) Release information disclosing system
JP2006146298A (en) System and method for adjusting timeout period for application, server apparatus and its program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20130403

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140121

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140204

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140407

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20140617

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140630

R150 Certificate of patent or registration of utility model

Ref document number: 5581820

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees