Vizualizați conținut de ajutor pentru versiunea:
- 6.4
- 6.3
- 6.2
- Versiuni mai vechi
The proxy server acts as an intermediate server that relays requests between a client and a server. The proxy server keeps track of all the client-server interactions and outputs a log of the entire TCP communication. This allows you to monitor exactly what is going on, without having to access the main server.
You can find the proxy server in the appropriate installation folder:
- <cq_install_path>/opt/helpers/proxy.jar
- <crx_install_path>/opt/helpers/proxy.jar
You can use the proxy server to monitor all client-server interaction, regardless of the underlying communication protocol. For example, you can monitor the following protocols:
- HTTP for Web pages
- HTTPS for secure Web pages
- SMTP for email messages
- LDAP for user management
For example, you can position the proxy server between any two applications that communicate via a TCP/IP network; e.g. a web browser and AEM. This allows you to monitor exactly what happens when you request a AEM page.
java -jar proxy.jar <host> <remoteport> <localport> [options]
- q (quiet Mode) Does not write the requests to the console window. Use this if you do not want to slow down the connection, or if you log the output to a file (see -logfile option).
- b (binary Mode) If you are looking for specific byte combinations in the traffic, enable binary mode. The output will then contain the hexadecimal and character output.
- t (time stamp log entries) Adds a time stamp to each log output. The time stamp is in seconds, so it may not be suitable for checking single requests. Use it to locate events that occurred at a specific time if you use the proxy server over a longer time period.
- logfile <filename> (write to log file) Writes the client-server conversation to a log file. This parameter works also in quiet mode.
- i <numIndentions> (add indention) Each active connection is indented for better readability. Default is 16 levels. (New in proxy.jar version 1.16).
The following scenarios illustrate a few of the purposes for which the Proxy Server Tool can be used:
Check for Cookies and their Values
The following log entry example shows all cookies and their values sent by the client on the 6th connection opened since proxy start:
C-6-#000635 -> [Cookie: cq3session=7e39bc51-ac72-3f48-88a9-ed80dbac0693; Show=ShowMode; JSESSIONID=68d78874-cabf-9444-84a4-538d43f5064d ]
S-7-#000017 -> [Connection: Keep-Alive ] ... S-7-#000107 -> [Content-Length: 124 ]
Checking if Keep-Alive works
Keep-Alive means that a client re-uses the connection to the server to transports multiple files (the page code, pictures, style sheets and so on). Without keep-alive, the client has to establish a new connection for each request.
To check if keep-alive works:
- Start the proxy server.
- Request a page.
- If keep-alive is working, the connection counter should never go above 5 to 10 connections.
- If keep-alive is not working, the connection counter increases rapidly.
Finding Lost Requests
If you lose requests in a complex server setting, for example with a firewall and a dispatcher, you can use the proxy server to find out where the request was lost. In case of a firewall:
- Start a proxy before a firewall
- Start another proxy after a firewall
- Use these to see how far the requests are getting.
Requests Hanging
If you experience hanging requests from time to time:
- Start a proxy.jar.
- Wait or write the access log into a file - with each entry having a timestamp.
- When the request start hanging you can see how many connections were open and which request is causing trouble.
[timestamp (optional)] [<b>C</b>lient|<b>S</b>erver]-[ConnectionNumber]-[BytePosition] ->[Character Stream]
C-0-#000000 -> [GET /author/prox.html?CFC_cK=1102938422341 HTTP/1.1 ]
- C signifies that this entry comes from the client (it is a request for a Web page)
- 0 is the connection number (the connection counter starts at 0)
- #00000 the offset in the byte stream. This is the first entry, so the offset is 0.
- [GET <?>] is the content of the request, in the example one of the HTTP headers (url).
When a connection closes, the following information is logged:
C-6-Finished: 758 bytes (1.0 kb/s) S-6-Finished: 665 bytes (1.0 kb/s)
<html> <head> <title>Welcome</title> </head> <body> Welcome to Playground<br> <img src="/logo.gif"> </body> </html>
java -jar proxy.jar localhost 4303 4444 -logfile test.log
Notă:
Until proxy.jar version 1.14, the log entries of one connection are not synchronized, meaning the log entries of one client/server connection are not necessary in the correct sequential order. The newer versions (>=1.14) of the proxy server do not have this issue.
starting proxy for localhost:4303 on port 4444 using logfile: C:\CQUnify355default\opt\helpers\test.log
C-0-#000000 -> [GET /author/prox.html?CFC_cK=1102936796533 HTTP/1.1 ] C-0-#000053 -> [Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, appl] C-0-#000194 -> [ication/x-shockwave-flash, */* ] C-0-#000227 -> [Accept-Language: de-ch ] C-0-#000251 -> [Accept-Encoding: gzip, deflate ] C-0-#000283 -> [User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) ] C-0-#000347 -> [Host: localhost:4444 ]
C-0-#000369 -> [Connection: Keep-Alive ]
The proxy server is a good tool to verify whether cookies are properly set or not. Here, we see the:
- cq3session cookie generated by AEM
- the show mode switch cookie generated by the CFC
- a cookie named JSESSIONID; this is automatically created by JSP if not explicitly switched off using <%@ page session="false" %>:
C-0-#000393 -> [Cookie: Show=ShowMode; cq3session=3bce15cf-1575-1b4e-8ea6-0d1a0c64738e; JSESSIONID=4161a56b-f193-d748-88a5-e09c5ff7ef2a ] C-0-#000514 -> [ ] S-0-#000000 -> [HTTP/1.0 200 OK ]
S-0-#000017 -> [Connection: Close ] S-0-#000036 -> [Server: Communique Servlet Engine/3.5.5 ] S-0-#000077 -> [Content-Type: text/html;charset=iso-8859-1 ] S-0-#000121 -> [Date: Tue, 14 Dec 2004 09:46:44 GMT ] S-0-#000158 -> [Set-Cookie: JSESSIONID=4161a56b-f193-d8-88a5-e09c5ff7ef2a;Path=/author ] S-0-#000232 -> [ ]
S-0-#000234 -> [<html> ] S-0-#000242 -> [.<head> ] S-0-#000251 -> [..<title>Welcome</title> ] S-0-#000277 -> [.</head> ] S-0-#000287 -> [.<body> ] S-0-#000296 -> [..Welcome to Playground<br> ] S-0-#000325 -> [..<img src="/author/logo.gif"> ] S-0-#000357 -> [.</body> ] S-0-#000367 -> [</html>]
C-0-Finished: 516 bytes (0.0 kb/s) S-0-Finished: 374 bytes (0.0 kb/s)
C-1-#000000 -> [GET /author/logo.gif HTTP/1.1 ] C-1-#000031 -> [Accept: */* ] C-1-#000044 -> [Referer: http://localhost:4444/author/prox.html?CFC_cK=1102936796533 ] C-1-#000114 -> [Accept-Language: de-ch ] C-1-#000138 -> [Accept-Encoding: gzip, deflate ] C-1-#000170 -> [User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) ] C-1-#000234 -> [Host: localhost:4444 ]
C-1-#000256 -> [Connection: Keep-Alive ] C-1-#000280 -> [Cookie: Show=ShowMode; cq3session=3bce15cf-1575-1b4e-8ea6-0d1a0c64738e; JSESSIONID=4161a56b-f193-d748-88a5-e09c5ff7ef2a ] C-1-#000401 -> [ ] S-1-#000000 -> [HTTP/1.0 200 OK ]
S-1-#000017 -> [Connection: Keep-Alive ] S-1-#000041 -> [Server: Communique Servlet Engine/3.5.5 ] S-1-#000082 -> [Content-Type: image/gif ]
S-1-#000107 -> [Content-Length: 124 ] S-1-#000128 -> [Date: Tue, 14 Dec 2004 09:46:44 GMT ] S-1-#000165 -> [ ]
S-1-#000167 -> [GIF87a......... ......... ... .....,....... ...I....0.A..8......YDA.W...1..`i.`..6...Z...$@.F..)`..f..A.....iu.........$..;]
S-1-Finished: 291 bytes (0.0 kb/s) C-1-Finished: 403 bytes (0.0 kb/s)
The above example is comparatively simple, because the two connections occur sequentially:
- first the server returns the HTML code
- then the browser requests the image and opens a new connection
In practice, a page may generate many parallel requests for images, style sheets, JavaScript files, etc. This means that the logs have overlapping entries of parallel open connections. In that case, we recommended to use option -i to improve readability.