HK1180487A1 - Method and device for testing a web application - Google Patents
Method and device for testing a web application Download PDFInfo
- Publication number
- HK1180487A1 HK1180487A1 HK13107586.0A HK13107586A HK1180487A1 HK 1180487 A1 HK1180487 A1 HK 1180487A1 HK 13107586 A HK13107586 A HK 13107586A HK 1180487 A1 HK1180487 A1 HK 1180487A1
- Authority
- HK
- Hong Kong
- Prior art keywords
- http request
- domain name
- address
- web application
- web
- Prior art date
Links
Landscapes
- Debugging And Monitoring (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention provides a method and a device for web application debugging. The method for the web application debugging comprises the following steps: analyzing a first hyper text transport protocol (HTTP) request through the obtaining of the first HTTP request of a default request port; confirming a first realm name of the first HTTP request; confirming a first preset transmission port corresponding to the first realm name; transmitting the first HTTP request to a corresponding web application through the first preset transmission port; receiving a response content returned by the web application; and returning the response content to a browser which sends the first HTTP request through the default request port. A plurality of web applications in a distributed web system can be simultaneously debugged on a same computer, remote file replication and remote switch operation among a plurality of computers are eliminated, and then operation efficiency of the deployment and the deployment for the web applications in the distributed web system is improved.
Description
Technical Field
The present invention relates to the field of network systems, and in particular, to a method and an apparatus for debugging a Web application.
Background
A plurality of Web server hosts distributed on a LAN or a WAN cooperate with each other in a self-organizing manner or in a manner that a dedicated device is responsible for organizing and scheduling to form a Web site, and share the load of a Web request from a user to the Web site. A distributed Web system contains a plurality of associated Web applications. In both the formal environment and the common testing environment, different Web applications are generally deployed on different computers, and there is an interrelation or dependency between each Web application. During the development process, developers often need to run these associated Web applications in a local debugging environment at the same time to debug the distributed Web system.
For example, a distributed Web system APP comprises three Web applications:
front-end A (abbreviated FEA), the domain name for external access to FEA in a public test environment is http:// FEA. taobao. org, the port is default 80, and the domain name points to IP address 110.110.0.10.
Front-end B (abbreviated FEB), the domain name for externally accessed FEB in a public test environment is http:// FEB. taobao. org, the port is default 80, and the domain name points to IP address 110.110.0.20.
Service Center (abbreviated SC), domain name of external access SC in public test environment is http:// SC.
The three Web applications are deployed on different machines respectively in a common test environment, wherein FEB depends on SC, and FEA depends on both FEB and SC. Because of the dependency relationship, when the FEB is locally debugged, the FEB and the SC are operated simultaneously; when the FEA is debugged locally, three applications of the FEA, the FEB and the SC are operated simultaneously.
In addition, the distributed system APP may be only one subsystem in the whole system. The distributed system APP can not be independently debugged locally by other subsystems of a common test environment when the distributed system is debugged.
For example, the distributed system APP can be accessed through the user login authentication subsystem. For smooth interfacing with other subsystems of a common test environment, domain names and ports accessed externally to each Web application need to be kept unchanged during local debugging. For three Web applications under the distributed system APP, namely, the domain name for accessing the FEA during local debugging is http:// fea.taobao.org and the port is 80, the corresponding port for accessing the FEB is 80 when the domain name for accessing the FEB is http:// feb.taobao.org, and the corresponding port for accessing the SC is 80 when the domain name for accessing the SC is http:// sc.taobao.org.
These two limitations make local debugging of distributed Web systems impossible to implement simply on a stand-alone basis, because generally FEA, FEB, SC all have their own specific Web server, and since the access ports are all default 80 ports, port conflicts can occur if their respective Web server instances are run simultaneously on one computer.
At present, in a technical scheme for debugging a distributed Web system, FEA, FEB, and SC applications are deployed on three computers, and then local domain name resolution hosts files of the three computers are modified, and domain names of the three applications are mapped to corresponding local computers. The FEA application is mapped to a computer where the FEA application is located, the FEB application is mapped to a computer where the FEB application is located, and the SC application is mapped to a computer where the SC application is located. When the FEA application is debugged, the FEA application needs to call the FEB application and the SC application, so that three computers run simultaneously.
In the process of implementing the invention of the present application, the applicant finds that at least the following technical problems exist in the above technology:
when a distributed Web system is locally debugged, because the Web applications in the Web system have a correlation and a calling relationship, a plurality of correlated Web applications need to be run simultaneously, and because one Web application in the Web system needs to be deployed on one computer independently, a plurality of computers need to be run simultaneously when one Web application is debugged. Moreover, switching operation needs to be performed between these computers during debugging, and file transmission back and forth between these computers is often also needed, so that a large amount of resources are occupied in the debugging process, and the debugging process is more complicated.
Disclosure of Invention
The application provides a method and a device for debugging Web application, which are used for solving the problems that in the prior art, when a distributed Web system is debugged, Web applications in the distributed Web system are required to be respectively deployed on different computers, switching operation needs to be carried out among the computers during debugging, files need to be transmitted back and forth among the computers, so that a large amount of resources are occupied in the debugging process, and the debugging process is complicated.
In order to solve the above problem, the present application provides a method for debugging a Web system, where N Web applications in the Web system are set on a terminal, each Web application corresponds to a domain name, where N is greater than or equal to 2, and the N applications are associated and invoked with each other, where the method specifically includes:
acquiring a first HTTP request of a default request port, and after determining that the first HTTP request is the HTTP requests corresponding to the N Web applications, analyzing the first HTTP request to determine a first domain name of the first HTTP request;
determining a first preset forwarding port corresponding to the first domain name according to a pre-stored corresponding relation between the first domain name and the first preset forwarding port, and forwarding the first HTTP request to a corresponding Web application through the first preset forwarding port;
and receiving response content returned by the Web application, and returning the response content to the browser sending the first HTTP request through a default request port.
Preferably, before the proxy server configured on the terminal obtains the first HTTP request of the default request port, the method further includes:
receiving requests of users for the N Web applications, and generating a first HTTP request according to the requests;
and performing local domain name resolution on the first HTTP request according to a corresponding relation between a pre-stored first domain name and a preset IP address to obtain the preset IP address corresponding to the first HTTP request, wherein the preset IP address is a system default local IP address.
Preferably, the analyzing the first HTTP request and determining the first domain name of the first HTTP request specifically include:
the proxy server reads the first domain name from the Host entry of the first HTTP request header.
Preferably, the pre-stored correspondence between the first domain name and a first preset forwarding port specifically includes: the first domain names correspond to the first preset forwarding ports one to one.
Preferably, one of the N Web applications corresponds to one unique first preset forwarding port.
Preferably, the forwarding the first HTTP request to the corresponding Web application through the first preset forwarding port specifically includes:
and determining the actual IP address of the requested Web application according to the pre-stored corresponding relation between the first preset forwarding port and the actual IP address of the Web application, and forwarding the first HTTP request to the corresponding Web application through the determined actual IP address of the Web application.
Preferably, the pre-stored correspondence between the first preset forwarding port and the actual IP address of the Web application is that the actual IP address of the Web application corresponds to the first preset forwarding port one to one.
Preferably, the preset IP address is a system default local IP address or a public environment tester IP address, and the method further includes:
and when the local domain name resolution is carried out on the first HTTP request, switching the domain name resolution result of the first HTTP request between the default local IP address of the system or the IP address of the public environment testing machine.
In addition, the present application provides an apparatus for debugging a Web application, including:
the browser receives requests of users for the N Web applications, generates a first HTTP request according to the requests, and receives corresponding contents of the HTTP returned by the proxy server;
the local domain name resolver performs local domain name resolution on the first HTTP request according to a pre-stored corresponding relationship between the first domain name and a default local IP address of the system to obtain a corresponding default local IP address;
the proxy server is used for acquiring a first HTTP request of a default request port, analyzing the first HTTP request after the first HTTP request is determined to be the HTTP requests corresponding to the N Web applications, determining a first domain name of the first HTTP request, determining a first preset forwarding port corresponding to the first domain name according to a pre-stored corresponding relation between the first domain name and a first preset forwarding port, forwarding the first HTTP request to the corresponding Web application through the first preset forwarding port, receiving response content returned by the Web application, and returning the response content to a browser sending the first HTTP request through the default request port;
and the Web application server generates response content of the Web application corresponding to the first HTTP request after receiving the first HTTP request, and returns the response content of the Web application to the proxy server.
Preferably, the method further comprises the following steps:
and the domain name converter is used for switching the domain name resolution result of the first HTTP request between the default local IP address of the system or the IP address of the public environment testing machine.
The beneficial effects are as follows:
by the method and the device for debugging the Web application, the distributed Web system can be debugged on one computer, so that remote file copying and remote operation switching among a plurality of computers are omitted, and the deployment and debugging operation efficiency of the Web application in the distributed Web system is improved.
And by the method, the result of the local domain name resolution of the HTTP request can be selected. And further, the fast switching of domain name resolution results in debugging is realized.
Drawings
Fig. 1 is a schematic diagram of a method for debugging a Web application according to an embodiment of the present application;
FIG. 2 is a flow chart of proxy server forwarding according to an embodiment of the present application;
fig. 3 is a flowchart illustrating specific setting of the Switchhost plug-in according to the embodiment of the present application;
fig. 4 is a schematic structural diagram of an apparatus for debugging a Web application according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides a method and a device for debugging Web application, which are used for realizing local debugging by simultaneously operating a plurality of Web applications of a distributed Web system on one terminal on the premise of not changing a domain name and a port accessed from the outside of the Web application.
The scheme provided by the invention is explained in detail in the following by combining the drawings and specific embodiments.
As shown in fig. 1, in the method for debugging a Web application provided in the embodiment of the present application, N Web applications of the distributed Web system are disposed on the same terminal, where N is greater than or equal to 2, and the N applications are associated and invoked with each other. The specific implementation flow of the method provided by the embodiment of the application is as follows:
step 101, the browser receives requests of the user for the N Web applications, and generates a first HTTP request according to the requests.
And 102, performing local domain name resolution on the first HTTP request by the local domain name resolver according to a corresponding relation between a prestored domain name and a preset IP address to obtain the preset IP address corresponding to the first HTTP request, wherein the preset IP address is a system default local IP address.
When the local domain name resolution is carried out on the first HTTP request, the corresponding relation between the domain name of the Web application and the preset IP address is prestored in an etc/hosts file of the local machine, so that the preset IP address can be obtained according to the domain name in the HTTP request after the HTTP request quoted by a user to a certain Web is received.
In the embodiment of the present application, since a single computer is required to debug each application in the Web system (that is, after a plurality of Web applications in the Web system are set in the same computer, each Web application is debugged), an HTTP request requesting a certain Web application needs to be sent back to the local computer. In order to achieve the above object, in this embodiment of the present invention, the preset IP address may be set as a default local IP address of the system, so that after the local domain name resolution is performed, the HTTP request is sent back to the local computer for resolution.
Step 103, the proxy server obtains a first HTTP request of the default request port, and after determining that the first HTTP request is an HTTP request corresponding to the N web applications, parses the first HTTP request, and determines a first domain name of the first HTTP request.
Because the preset IP address is set as the local address in step 102, when a request is sent to a Web application set in the local browser, the local browser generates a first HTTP request correspondingly, and sends the first HTTP request through a default request port, and the proxy server can monitor the first HTTP request from the default request port and parse the first HTTP request after acquiring the first HTTP request.
The proxy server can correspondingly analyze the first HTTP request according to different access modes. For example, if the first HTTP request is accessed according to a domain name, the Host of the header information is stored as the domain name; if the access is based on the IP address, the Host stores the IP address. In the embodiment of the present application, the first HTTP request is accessed according to a domain name, and therefore, a domain name is stored in the Host entry of the HTTP request header information. After receiving the HTTP request, the proxy server reads the first domain name from the Host item of the first HTTP request header information.
Since the IP addresses obtained by step 103 are all system default native IP addresses, the N Web applications of the first HTTP request whose IP addresses are all native system default IP addresses are distinguished by the first domain name in the present embodiment.
And 104, the proxy server determines a first preset forwarding port corresponding to the first domain name according to a pre-stored corresponding relationship between the domain name and the first preset forwarding port, and forwards the first HTTP request to a corresponding Web application through the first preset forwarding port.
In a specific embodiment, because a calling relationship exists between the N Web applications, before the N Web applications in the distributed Web system run, a corresponding first preset forwarding port needs to be set for each of the N Web applications, and each of the N Web applications corresponds to a unique first preset forwarding port, so that mutual conflicts between the ports do not occur when the N Web applications are called each other. And the corresponding relation between the Web application and the first preset forwarding port is also prestored in the proxy server.
Each of the N Web applications corresponds to a first domain name, and each first domain name corresponds to a unique first preset forwarding port, so that the first domain names correspond to the first preset forwarding ports one to one.
Further, the proxy server may obtain a first preset forwarding port for forwarding the first HTTP request to the corresponding Web application through the first domain name obtained in step 103 and a one-to-one correspondence relationship between the pre-stored first domain name and the first preset forwarding port, so that the proxy server forwards the first HTTP request to the corresponding Web application through the first preset forwarding port.
And 105, the proxy server receives response content returned by the Web application and returns the response content to the browser sending the first HTTP request through a default request port.
Fig. 2 is a specific process of forwarding the first HTTP request to a corresponding Web application by the proxy server, as follows:
step 201, determining the actual IP address of the requested Web application according to the pre-stored corresponding relationship between the first preset forwarding port and the actual IP address of the Web application.
In order to enable the HTTP request to be sent to the actual server of the corresponding Web application, the actual IP address of the Web application needs to be obtained. In this embodiment, the corresponding relationship between the first preset forwarding port and the actual IP address of the Web application is pre-stored in the proxy server.
Further, after the proxy server obtains the first domain name through analysis, the actual IP address of the Web application is obtained according to the corresponding relationship between the first preset forwarding port and the actual IP address of the Web application, which is prestored.
Step 202, forwarding the HTTP request to the corresponding Web application through the determined actual IP address.
If the distributed Web system in this embodiment includes three Web applications and the three Web applications have a mutual call relationship, the method provided in this embodiment of the present application is further described according to a specific application environment, which specifically includes:
the distributed Web system in this embodiment includes three Web applications, which are FEA, FEB, and SC, and when the FEA application is debugged, the FEB application and the SC application are called; the SC application is invoked when the FEB is debugged. Since the three applications FEA, FEB, and SC are in a mutual calling relationship, when the FEA is debugged, the applications FEB and SC are called in the same line, and thus, requests are sent to the three applications FEA, FEB, and SC at the same time.
Therefore, before the three Web applications run on a terminal, the following settings are performed on the ports of the three Web applications:
the corresponding port of the FEA application is 8080;
the corresponding port of the FEB application is 8180;
the corresponding port of the SC application is 8280;
the configuration of the proxy server may specifically be:
the proxy server monitors HTTP requests from FEA, FEB and SC applications of 80 ports. The domain name is fea. 80 HTTP request is forwarded to IP address: http://127.0.0.1: 8080;
the domain name is feb. 80 HTTP request is forwarded to IP address: http://127.0.0.1: 8180;
the domain name is sc.taobao.org, and the port is: 80 HTTP request is forwarded to IP address: IP address http://127.0.0.1: 8280;
through the setting, the corresponding preset ports of the three applications of the FEA, the FEB and the SC are prestored on the proxy server.
Running three applications of FEA, FEB and SC after the port setting is finished on a terminal, wherein the domain names corresponding to the three applications are FEA. And preset IP addresses corresponding to the three application domain names are set in a local domain name resolution file etc \ hosts, so that HTTP requests of the three applications can be forwarded back to the local machine after being subjected to local domain name resolution, and therefore the preset IP addresses are default local machine IP addresses of the system, and the specific setting is as follows:
the domain name corresponding to the FEA is: http:// fea. taobao. org, the IP address obtained after local domain name resolution is: 127.0.0.1; the ports are: 80;
the domain name corresponding to the FEB is: http:// feb. taobao. org, the IP address obtained after local domain name resolution is: 127.0.0.1; the ports are: 80;
the domain name corresponding to the SC is: http:// sc. taobao. org, the IP address obtained after local domain name resolution is: 127.0.0.1; the ports are: 80;
after the local domain name resolution is carried out on the three applications of FEA, FEB and SC through the setting, the obtained preset IP address is the default local IP address of the system, so the HTTP requests corresponding to the three Web applications are transmitted back to the local through the default request port.
The HTTP requests of the three applications of FEA, FEB and SC after the local domain name resolution are sent back to the local machine through the default request port, so that the proxy server can monitor the HTTP requests from the default request port, and further obtain the respective HTTP requests of the three applications of FEA, FEB and SC.
The proxy server analyzes the acquired HTTP requests of the three applications of the FEA, the FEB and the SC, reads the domain name from the Host item of the HTTP request header information, and further acquires the domain names corresponding to the three applications of the FEA, the FEB and the SC, wherein the specific corresponding relationship is as follows:
the domain name corresponding to the FEA is: http:// fea.taobao.org;
the domain name corresponding to the FEB is: http:// feb.taobao.org;
the domain name corresponding to the SC is: http:// sc.
After the HTTP requests of the three applications, namely the FEA, the FEB and the SC, are subjected to local domain name resolution, the obtained preset IP addresses are all the default local IP addresses of the system, so that after the domain names corresponding to the three applications, namely the FEA, the FEB and the SC, are obtained through the proxy server resolution, the three applications can be distinguished from one another.
Further, the proxy server sets respective corresponding preset ports through the prestored three applications of FEA, FEB, and SC, and respectively reads the respective corresponding preset ports of the three applications of FEA, FEB, and SC, which is as follows:
the corresponding port of the FEA application is 8080;
the corresponding port of the FEB application is 8180;
the corresponding port for SC applications is 8280.
After obtaining the corresponding ports of the three applications, namely, FEA, FEB, and SC, the proxy server further obtains the actual IP addresses of the servers of the three applications, namely, FEA, FEB, and SC, as follows:
the port corresponding to FEA is 8080, and the actual IP address is: http://127.0.0.1:8080
The port corresponding to the FEB is 8180, and the actual IP address is: http://127.0.0.1:8180
The port corresponding to the SC is 8280, and the actual IP address is: http://127.0.0.1:8280
And the proxy server forwards the HTTP requests corresponding to the three applications of the FEA, the FEB and the SC through the obtained actual IP addresses of the servers of the three applications of the FEA, the FEB and the SC.
And the proxy server receives response contents returned by the three applications of FEA, FEB and SC, and returns the response contents to the browser sending the HTTP request through a default request port.
In addition, in another specific embodiment of the present application, after performing local domain name resolution on the first HTTP request, the obtained preset IP address is a system default local IP address or a public environment test machine IP address.
And when the local domain name resolution is carried out on the first HTTP request, switching the local domain name resolution result of the first HTTP request between the default local IP address of the system or the IP address of the public environment testing machine.
By the method, the result of the local domain name resolution of the HTTP request can be selected.
In order to implement the switching between the IP addresses, in the embodiment of the present application, a switch (transition host) plug-in is specifically selected to complete the switching, and an analysis result of local domain name resolution of the Web application may be prestored in the switch host plug-in. In this embodiment of the present application, a local domain name resolution result of the Web application may be set in the Switchhost plug-in as a system default local IP address or a public environment tester IP address, and therefore, the preset IP address is the system default local IP address or the public environment tester IP address.
The embodiments of the present application are further described below according to specific application environments.
For example, in the etc/hosts file of the plug-in, the IP address after http:// FEA. taobao.org and http:// FEB. taobao.org are resolved by the local domain name is set as the default local IP address 127.0.0.1 of the system, and the IP address after http:// SC. taobao.org is resolved by the local domain name is the public testing environment machine IP address 110.110.0.30, so that the debugging combination of the three applications is local FEA + local FEB + SC of the public testing environment. Because the FEA, the FEB, and the SC in a specific environment can set the IP address after the local domain name resolution as the local IP address or the machine IP address in the public test environment, the debugging combination of the three applications may be:
native FEA + native FEB + native SC
Native FEA + native FEB + common SC
Native FEA + common FEB + common SC
Public FEA + local FEB + public SC
Common FEA + common FEB + native SC
Public FEA + native FEB + native SC
As shown in fig. 3, the specific settings for the Switchhost plug-in are as follows:
step 301, selecting a sub-menu Host Management under the Switchhost, and entering a Hostsmanagement interface;
step 302, if a new hosts setting is to be added, clicking an 'Add' button to generate a hostsEdit interface, then inputting host-ip pairs one by one, and naming the hosts setting;
step 303, after the saving is clicked, the Hosts setting will appear in the Switchhost submenu, and also appear in the Switchhost shortcut menu on the right side of the status bar below the browser, and the following multiple Hosts settings can be created:
native FEA + native FEB + native SC
Native FEA + native FEB + common SC
Native FEA + common FEB + common SC
Public FEA + local FEB + public SC
Common FEA + common FEB + native SC
Public FEA + native FEB + native SC
After a plurality of Hosts settings are created, one of the Hosts settings is selected as the current operating environment. Only the Switchhost shortcut menu of the browser status bar needs to be clicked, the Hosts setting needing to be operated is selected, the Switchhost can automatically replace the etc/Hosts file content of the operating system with the Host-IP pairing in the selected Hosts setting, and then the local domain name resolution of the operating system carries out local domain name resolution on the HTTP request based on the selected Hosts setting.
The debugging combinations are possible to occur in the concrete implementation process, a hosts version can be set in the Switchhost plug-in for each debugging combination, and then the one-key switching function of the Switchhost plug-in is used for quickly switching to any one of the debugging combinations. Thereby realizing multiple choices of debugging environment.
Since only the proxy service function is needed in this embodiment, the Web application does not need to be deployed on the HTTP Server, and the access amount is small during debugging, the memory usage of the HTTP Server is small.
Fig. 4 shows a structure of an apparatus for debugging a Web application according to an embodiment of the present application, where the specific structure of the apparatus includes the following functional units:
the browser 401 is configured to receive requests of the user for the N Web applications, and generate a first HTTP request according to the requests;
a local domain name resolver 402, configured to perform local domain name resolution on the first HTTP request according to a pre-stored correspondence between the first domain name and a default local IP address of the system, obtain a corresponding default local IP address, and receive corresponding content of the HTTP returned by the forwarding unit;
performing local domain name resolution on the first HTTP request according to a pre-stored corresponding relationship between the first domain name and a default local IP address of the system to obtain a corresponding default local IP address, and receiving corresponding content of the HTTP returned by the forwarding unit;
the proxy server 403 is configured to obtain a first HTTP request of a default request port, parse the first HTTP request after determining that the first HTTP request is an HTTP request corresponding to the N Web applications, determine a first domain name of the first HTTP request, determine a first preset forwarding port corresponding to the first domain name according to a correspondence between a pre-stored first domain name and the first preset forwarding port, forward the first HTTP request to a corresponding Web application through the first preset forwarding port, receive response content returned by the Web application, and return the response content to a browser that sends the first HTTP request through the default request port.
And the Web application server 404 is configured to generate response content of the Web application corresponding to the HTTP request after receiving the first HTTP request, and return the response content of the Web application to the proxy server.
In addition, the apparatus further comprises:
a domain name converter 405, configured to switch a domain name resolution result of the first HTTP request between the default local IP address of the system or the IP address of the public environment testing machine.
The application has the following beneficial effects:
the application provides a method and a device for debugging Web application, wherein a first HTTP request of a default request port is obtained, the first HTTP request is analyzed, a first domain name of the first HTTP request is determined, a first preset forwarding port corresponding to the first domain name is determined, the first HTTP request is forwarded to the corresponding Web application through the first preset forwarding port, response content returned by the Web application is further received, and the response content is returned to a browser sending the first HTTP request through the default request port. In addition, the
The debugging of the distributed Web system on one computer is realized, so that remote file copying and remote operation switching among a plurality of computers are omitted, and the deployment and debugging operation efficiency of Web application in the distributed Web system is improved.
In addition, when the local domain name resolution is performed on the first HTTP request, the domain name resolution result of the first HTTP request is switched between the default local IP address of the system or the IP address of the public environment testing machine.
And by the method, the result of the local domain name resolution of the HTTP request can be selected.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
Claims (10)
1. A method for debugging Web application, N Web applications in a Web system are arranged on a terminal, each Web application corresponds to a domain name, wherein N is more than or equal to 2, and the N applications are mutually associated and called, and the method is characterized by specifically comprising the following steps:
acquiring a first HTTP request of a default request port, and after determining that the first HTTP request is the HTTP requests corresponding to the N Web applications, analyzing the first HTTP request to determine a first domain name of the first HTTP request;
determining a first preset forwarding port corresponding to the first domain name according to a pre-stored corresponding relation between the first domain name and the first preset forwarding port, and forwarding the first HTTP request to a corresponding Web application through the first preset forwarding port;
and receiving response content returned by the Web application, and returning the response content to the browser sending the first HTTP request through a default request port.
2. The method of claim 1, wherein before the proxy server provided on the terminal obtains the first HTTP request of the default request port, further comprising:
receiving requests of users for the N Web applications, and generating a first HTTP request according to the requests;
and performing local domain name resolution on the first HTTP request according to a corresponding relation between a pre-stored first domain name and a preset IP address to obtain the preset IP address corresponding to the first HTTP request, wherein the preset IP address is a local IP address which is defaulted by a system.
3. The method according to claim 1, wherein said parsing the first HTTP request and determining the first domain name of the first HTTP request specifically comprises:
the proxy server reads the first domain name from the Host entry of the first HTTP request header.
4. The method according to claim 3, wherein the pre-stored correspondence between the first domain name and a first preset forwarding port specifically is: the first domain names correspond to the first preset forwarding ports one to one.
5. The method of claim 4, wherein one of N of said Web applications corresponds to a unique one of said first pre-determined forwarding ports.
6. The method of claim 1, wherein forwarding the first HTTP request to the corresponding Web application through the first pre-determined forwarding port specifically includes:
and determining the actual IP address of the requested Web application according to the pre-stored corresponding relation between the first preset forwarding port and the actual IP address of the Web application, and forwarding the first HTTP request to the corresponding Web application through the determined actual IP address of the Web application.
7. The method according to claim 6, wherein the pre-stored correspondence between the first pre-set forwarding port and the actual IP address of the Web application is a one-to-one correspondence between the actual IP address of the Web application and the first pre-set forwarding port.
8. The method of claim 2, wherein the preset IP address is a system default native IP address or a public environment tester IP address, the method further comprising:
and when the local domain name resolution is carried out on the first HTTP request, switching the domain name resolution result of the first HTTP request between the default local IP address of the system or the IP address of the public environment testing machine.
9. An apparatus for debugging a Web application, comprising:
the browser receives requests of users for the N Web applications, generates a first HTTP request according to the requests, and receives corresponding contents of the HTTP returned by the proxy server;
the local domain name resolver performs local domain name resolution on the first HTTP request according to a pre-stored corresponding relationship between the first domain name and a default local IP address of the system to obtain a corresponding default local IP address;
the proxy server is used for acquiring a first HTTP request of a default request port, analyzing the first HTTP request after the first HTTP request is determined to be the HTTP requests corresponding to the N Web applications, determining a first domain name of the first HTTP request, determining a first preset forwarding port corresponding to the first domain name according to a pre-stored corresponding relation between the first domain name and a first preset forwarding port, forwarding the first HTTP request to the corresponding Web application through the first preset forwarding port, receiving response content returned by the Web application, and returning the response content to a browser sending the first HTTP request through the default request port;
and the Web application server generates response content of the Web application corresponding to the first HTTP request after receiving the first HTTP request, and returns the response content of the Web application to the proxy server.
10. The apparatus of claim 9, further comprising:
and the domain name converter is used for switching the domain name resolution result of the first HTTP request between the default local IP address of the system or the IP address of the public environment testing machine.
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110350189.3A CN103095783B (en) | 2011-11-08 | 2011-11-08 | A kind of method and device debugging Web application |
Publications (2)
Publication Number | Publication Date |
---|---|
HK1180487A1 true HK1180487A1 (en) | 2013-10-18 |
HK1180487B HK1180487B (en) | 2016-07-08 |
Family
ID=
Also Published As
Publication number | Publication date |
---|---|
CN103095783B (en) | 2015-10-14 |
CN103095783A (en) | 2013-05-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103095783B (en) | A kind of method and device debugging Web application | |
US7568032B2 (en) | Method of balancing load among mirror servers | |
CN102647482B (en) | Method and system for accessing website | |
CN109587254B (en) | Cloud server access method and device, cloud server and storage medium | |
JP2021121972A (en) | Mini-program processing methods, servers, equipment, storage media, and programs | |
CN109347998B (en) | Method and system for detecting IP address of DNS (Domain name Server) outlet server | |
CN111262839A (en) | Vulnerability scanning method, management equipment, node and storage medium | |
KR20080111005A (en) | System and method for creating, performing and mapping services | |
CN107818268A (en) | The access control method and server of big data platform | |
KR101775026B1 (en) | Method and apparatus for providing pair play service | |
CN106209515A (en) | Automatic test system for access network equipment | |
CN104102578A (en) | Test method and system and operation terminal | |
US8930935B2 (en) | Composite service refactoring | |
US9244882B2 (en) | Provisioning network resources based on environment | |
CN114416169B (en) | Data processing method, medium, device and computing equipment based on micro front end | |
CN105573905A (en) | Software compatibility testing method and system | |
CN102684894B (en) | Method and device for realizing northboundbound interface | |
US9094301B2 (en) | Provisioning network resources by environment and network address | |
Griffioen et al. | Measuring experiments in GENI | |
CN111130948A (en) | Network quality detection method and device | |
Tanganelli et al. | A distributed architecture for discovery and access in the internet of things | |
HK1180487B (en) | Method and device for testing a web application | |
CN105306238B (en) | Terminal access method, device and system | |
Griffioen et al. | The design of an instrumentation system for federated and virtualized network testbeds | |
CN111581172A (en) | Query method, system, server and storage medium for running log |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PC | Patent ceased (i.e. patent has lapsed due to the failure to pay the renewal fee) |
Effective date: 20241108 |