Current Location:Home - News - Advancedknowledge
|
|||
Published:2010.08.04 News Sources:admin Views: | |||
After Deputy Yi Hou, due to the client and the middle layer between the services increased, so the server can not directly get the client IP, server-side applications Ye not viewable by forwarding the requested address to return to the client. However, in forwarding the request HTTD header, add HTTP_X_FORWARDED_???? Information. To track the client IP address of the original and the original client requests the server address: Here are two examples to illustrate the application of design principles cache Compatibility:
'Need for a server name in the address of the ASP application: Do not directly quote HTTP_HOST / SERVER_NAME, determine whether there HTTP_X_FORWARDED_SERVER function getHostName () dim hostName as String = "" hostName = Request.ServerVariables ("HTTP_HOST") if not isDBNull (Request . ServerVariables ("HTTP_X_FORWARDED_HOST")) then if len (trim (Request.ServerVariables ("HTTP_X_FORWARDED_HOST")))> 0 then hostName = Request.ServerVariables ("HTTP_X_FORWARDED_HOST") end if end if return hostNmae end function / / for a required record the client IP in PHP applications: Do not directly quote REMOTE_ADDR, but to use the HTTP_X_FORWARDED_FOR, function getUserIP () ($ user_ip = $ _SERVER ["REMOTE_ADDR"]; if ($ _SERVER ["HTTP_X_FORWARDED_FOR"]) ($ user_ip = $ _SERVER ["HTTP_X_FORWARDED_FOR"];)) Note: HTTP_X_FORWARDED_FOR if after a number of intermediate proxy server, what can be a comma separated multiple addresses, For example: 200.28.7.155,200.10.225.77 unknown, 219.101.137.3 So many old database design (such as BBS) is often used to record the client address field is set to 20 bytes becomes too small. Often see an error message similar to the following:
Microsoft JET Database Engine error '80040e57 '
Field is too small to accept the amount of data to be added. Try inserting or pasting less data.
/ Inc / char.asp, line 236
The reason is that in the design of client access address, user IP field related to the size of the best design to 50 bytes or more, of course, after more than 3 layers is very small chance of agents. How to check the current page to the cache of the site (Cacheablility) do? Can refer to the following two site tools: http://www.ircache.net/cgi-bin/cacheability.py |
|||
This Paper Is Divided Into 1 Page | |||
|
|||