A source code access method and device
By generating a mapping between pseudo-paths and real paths, and using a reverse proxy server to find the real path, the problem of JavaScript source code confidentiality and debugging is solved, achieving a balance between security and debuggability.
Patent Information
- Application Number
- CN202110980837.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-25
- Publication Date
- 2026-08-04
- Estimated Expiration
- 2041-08-25
Smart Images

Figure CN115730276B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method and apparatus for accessing source code. Background Technology
[0002] In web pages, if the page directly uses JavaScript source code, the source code can be viewed directly through the browser, compromising code confidentiality and security. To ensure source code confidentiality and security, browsers can process the source code to obtain unreadable production code. However, when program problems arise, the unreadable production code makes debugging difficult in a production environment using a browser.
[0003] Therefore, when using production code to provide services, ensuring the security of source code access while switching from production code to source code for developers to debug becomes an urgent problem to be solved. Summary of the Invention
[0004] To address the aforementioned technical problems, this application provides a source code access method and apparatus to ensure the security of source code access while simultaneously providing debugging support for developers when switching from production code to source code. The technical solution is as follows:
[0005] A source code access method, applied to a backend server, includes:
[0006] In response to a browser's page access request, the production code is loaded and sent to the browser. The production code is obtained by hiding the source code.
[0007] In response to the browser's source code retrieval request, if a pseudo path of the source code is obtained from the source code retrieval request, the pseudo path of the source code is sent to the reverse proxy server so that the reverse proxy server can find the real path that matches the pseudo path of the source code. If a match is found, the real path is returned to the backend server.
[0008] The pseudo path of the source code is determined in the following way: when the browser responds to the source code debugging request and obtains the key field from the source code debugging request, it generates the pseudo path of the source code based on the path of the production code and the key value corresponding to the key field.
[0009] Based on the actual path, the source code is obtained and returned to the browser.
[0010] Optionally, after responding to the browser's source code acquisition request, the method further includes:
[0011] If the pseudo path of the source code is not obtained from the source code retrieval request, but the real path of the source code is obtained from the source code retrieval request, then the real path of the source code is sent to the reverse proxy server, so that the reverse proxy server maps the real path of the source code to the target path and returns the target path to the backend server, and the data corresponding to the target path does not contain the source code at least;
[0012] Return the data corresponding to the target path to the browser.
[0013] Optionally, the data corresponding to the target path may include a 404 error message.
[0014] Optionally, if the reverse proxy server fails to find a real path that matches the pseudo path of the source code and returns a matching failure message, the space corresponding to the pseudo path of the source code is accessed. If the space corresponding to the pseudo path of the source code does not contain data, a 404 error message is returned to the browser.
[0015] A source code access method, characterized in that the method includes:
[0016] A page access request is sent to the backend server, so that the backend server responds to the page access request, loads the production code, and sends the production code to the browser. The production code is obtained by hiding the source code.
[0017] Receive the production code;
[0018] In response to a source code debugging request, if a key field is obtained from the source code debugging request, a pseudo path to the source code is generated based on the path to the production code and the key value corresponding to the key field.
[0019] A source code retrieval request carrying a pseudo path to the source code is sent to the backend server, so that the backend server responds to the source code retrieval request from the browser. If the pseudo path to the source code is obtained from the source code retrieval request, the pseudo path to the source code is sent to the reverse proxy server, so that the reverse proxy server finds the real path that matches the pseudo path to the source code. If a match is found, the real path is returned to the backend server. The backend server retrieves the source code based on the real path and returns the source code to the browser so that the browser can debug the source code.
[0020] A source code access device, applied to a backend server, the device comprising:
[0021] The first response module is used to respond to the browser's page access request, load the production code, and send the production code to the browser. The production code is obtained by hiding the source code.
[0022] The second response module is used to respond to the browser's source code retrieval request. If a pseudo path of the source code is obtained from the source code retrieval request, the pseudo path of the source code is sent to the reverse proxy server so that the reverse proxy server can find the real path that matches the pseudo path of the source code. If a match is found, the real path is returned to the backend server.
[0023] The pseudo path of the source code is determined in the following way: when the browser responds to the source code debugging request and obtains the key field from the source code debugging request, it generates the pseudo path of the source code based on the path of the production code and the key value corresponding to the key field.
[0024] The acquisition module is used to acquire the source code based on the real path;
[0025] The first return module is used to return the source code to the browser.
[0026] Optionally, the device further includes:
[0027] The sending module is configured to send the real path of the source code to the reverse proxy server if the pseudo path of the source code is not obtained from the source code acquisition request, but the real path of the source code is obtained from the source code acquisition request, so that the reverse proxy server maps the real path of the source code to the target path and returns the target path to the backend server, wherein the data corresponding to the target path does not contain the source code at least.
[0028] The second return module is used to return the data corresponding to the target path to the browser.
[0029] 8. The apparatus according to claim 7, wherein the data corresponding to the target path includes a 404 error message.
[0030] Optionally, the device further includes:
[0031] The third return module is used to access the space corresponding to the pseudo path of the source code when the reverse proxy server returns a matching failure message indicating that no real path matching the pseudo path of the source code has been found. If the space corresponding to the pseudo path of the source code does not contain data, a 404 error message is returned to the browser.
[0032] A source code access device for use with a browser, the device comprising:
[0033] The first sending module is used to send a page access request to the backend server, so that the backend server responds to the page access request, loads the production code, and sends the production code to the browser. The production code is obtained by hiding the source code.
[0034] A receiving module is used to receive the production code;
[0035] A generation module is used to respond to a source code debugging request and, if a key field is obtained from the source code debugging request, generate a pseudo path for the source code based on the path of the production code and the key value corresponding to the key field.
[0036] The second sending module is used to send a source code retrieval request carrying a pseudo path of the source code to the backend server, so that the backend server responds to the source code retrieval request of the browser. If the pseudo path of the source code is obtained from the source code retrieval request, the pseudo path of the source code is sent to the reverse proxy server, so that the reverse proxy server finds the real path that matches the pseudo path of the source code. If a match is found, the real path is returned to the backend server. The backend server retrieves the source code based on the real path and returns the source code to the browser so that the browser can debug the source code.
[0037] Compared with the prior art, the beneficial effects of this application are as follows:
[0038] In this application, production code is loaded in response to a browser's page access request, and then sent to the browser. This ensures that the production code provides services when the browser initiates a page access request, thereby guaranteeing the confidentiality and security of the source code.
[0039] Furthermore, in response to a source code debugging request, if the browser obtains a key field from the request, it generates a pseudo path for the source code based on the path of the generated code and the key value corresponding to the key field. This pseudo path is then sent to the backend server. The backend server sends the pseudo path to the reverse proxy server, which searches for a real path that matches the pseudo path. If a match is found, the reverse proxy server returns the real path to the backend server. The backend server then retrieves the source code based on the real path. This system ensures that access to the source code is only possible through generating a pseudo path using the key field and mapping it to the real path, thereby improving the security of source code access.
[0040] Furthermore, when modifying the key field, only the mapping relationship between the pseudo path and the real path of the source code in the reverse proxy server needs to be changed. There is no need to change the physical storage directory of the source code on the backend server, and no code needs to be modified, which reduces the workload of modification and maintenance costs. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 This is a flowchart of a source code access method provided in Embodiment 1 of this application;
[0043] Figure 2 This is a flowchart of a source code access method provided in Embodiment 2 of this application;
[0044] Figure 3 This is a flowchart of a source code access method provided in Embodiment 3 of this application;
[0045] Figure 4 This is a flowchart of a source code access method provided in Embodiment 4 of this application;
[0046] Figure 5 This is a schematic diagram of the logical structure of a source code access device provided in this application;
[0047] Figure 6 This is a schematic diagram of the logical structure of another source code access device provided in this application. Detailed Implementation
[0048] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0049] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0050] Reference Figure 1 This is a flowchart of a source code access method provided in Embodiment 1 of this application. This method can be applied to a backend server, such as... Figure 1As shown, the method may include, but is not limited to, the following steps:
[0051] Step S11: In response to the browser's page access request, load the production code and send the production code to the browser. The production code is obtained by hiding the source code.
[0052] In this embodiment, the backend server deploys the source code and production code to different directories, ensuring that the actual path of the source code differs from the path of the production code. For example, the production code is deployed in the js directory, and the source code is deployed in the js_src directory.
[0053] Step S12: In response to the browser's source code retrieval request, if a pseudo path of the source code is obtained from the source code retrieval request, the pseudo path of the source code is sent to the reverse proxy server so that the reverse proxy server can find the real path that matches the pseudo path of the source code. If a match is found, the real path is returned to the backend server.
[0054] The pseudo path of the source code is determined in the following way: when the browser responds to the source code debugging request and obtains the key field from the source code debugging request, it generates the pseudo path of the source code based on the path of the production code and the key value corresponding to the key field.
[0055] In this embodiment, the backend server can specify a key value and expose the specified key value to a specified user, so that the user can send a source code debugging request carrying the key value to the backend server when requesting program debugging.
[0056] When the backend server specifies a key value (e.g., Ds4wY0), the backend server can generate a pseudo path to the source code (e.g., xx / js_Ds4wY0 / ) based on the path to the production code and the key value corresponding to the key field. The backend server then sends the pseudo path and the real path of the source code (e.g., xx / js_src / ) to the reverse proxy server. The reverse proxy server configures the mapping relationship between the pseudo path and the real path of the source code.
[0057] Of course, users can send a source code debugging request to the browser (e.g., page.html?src_key=Ds4wY0). In response to the source code debugging request, the browser can obtain the key field (e.g., src_key) from the source code debugging request, generate a pseudo path to the source code based on the path to the production code and the key value (Ds4wY0) corresponding to the key field, and send the source code retrieval request carrying the pseudo path to the source code to the backend server.
[0058] Based on the path of the production code and the key value corresponding to the key field, a pseudo path of the source code is generated. This may include, but is not limited to, concatenating the key value corresponding to the key field (e.g., Ds4wY0) with the path of the production code (e.g., xx / js / test.js) to obtain the pseudo path of the source code (e.g., xx / js_Ds4wY0 / test.js).
[0059] In response to the browser's source code retrieval request, if a pseudo path to the source code is obtained from the source code retrieval request, the pseudo path to the source code is sent to the reverse proxy server.
[0060] When a reverse proxy server receives a pseudo path to the source code sent by a backend server, it searches for a real path that matches the pseudo path in the configured mapping relationship. If a match is found, the reverse proxy server returns the real path to the backend server.
[0061] Step S13: Based on the real path, obtain the source code and return the source code to the browser.
[0062] After the source code is returned to the browser, the user can use the source code received by the browser to debug the program.
[0063] In this application, production code is loaded in response to a browser's page access request, and then sent to the browser. This ensures that the production code provides services when the browser initiates a page access request, thereby guaranteeing the confidentiality and security of the source code.
[0064] Furthermore, in response to a source code debugging request, if the browser obtains a key field from the request, it generates a pseudo path for the source code based on the path of the generated code and the key value corresponding to the key field. This pseudo path is then sent to the backend server. The backend server sends the pseudo path to the reverse proxy server, which searches for a real path that matches the pseudo path. If a match is found, the reverse proxy server returns the real path to the backend server. The backend server then retrieves the source code based on the real path. This system ensures that access to the source code is only possible through generating a pseudo path using the key field and mapping it to the real path, thereby improving the security of source code access.
[0065] Furthermore, when modifying the key field, only the mapping relationship between the pseudo path and the real path of the source code in the reverse proxy server needs to be changed. There is no need to change the physical storage directory of the source code on the backend server, and no code needs to be modified, which reduces the workload of modification and reduces maintenance costs.
[0066] As another optional embodiment of this application, refer to Figure 2 This is a flowchart of a source code access method provided in Embodiment 2 of this application. This embodiment is mainly an extension of the source code access method described in Embodiment 1 above, such as... Figure 2 As shown, the method may include, but is not limited to, the following steps:
[0067] Step S21: In response to the browser's page access request, load the production code and send the production code to the browser. The production code is obtained by hiding the source code.
[0068] Step S22: In response to the browser's source code retrieval request, if a pseudo path of the source code is obtained from the source code retrieval request, the pseudo path of the source code is sent to the reverse proxy server so that the reverse proxy server can find the real path that matches the pseudo path of the source code. If a match is found, the real path is returned to the backend server.
[0069] The pseudo path of the source code is determined in the following way: when the browser responds to the source code debugging request and obtains the key field from the source code debugging request, it generates the pseudo path of the source code based on the path of the production code and the key value corresponding to the key field.
[0070] Step S23: Based on the real path, obtain the source code and return the source code to the browser.
[0071] For detailed procedures of steps S21-S23, please refer to the relevant description of steps S11-S13 in Example 1, which will not be repeated here.
[0072] Step S24: If the pseudo path of the source code is not obtained from the source code retrieval request, but the real path of the source code is obtained from the source code retrieval request, then the real path of the source code is sent to the reverse proxy server so that the reverse proxy server maps the real path of the source code to the target path and returns the target path to the backend server. The data corresponding to the target path does not contain the source code at least.
[0073] In this embodiment, the reverse proxy server can be configured to map the real path of the source code to the target path. Based on this, if the reverse proxy server receives the real path of the source code, it can map the real path of the source code to the target path, preventing the browser from accessing the source code through the real path.
[0074] In this embodiment, the data corresponding to the target path may include, but is not limited to, a 404 error message.
[0075] Step S25: Return the data corresponding to the target path to the browser.
[0076] In this embodiment, the reverse proxy server reverse proxies the real path of the source code to the target path, thus preventing the source code from being leaked if the real path of the source code is stolen, and further ensuring the security of the source code.
[0077] As another optional embodiment of this application, refer to Figure 3 This is a flowchart of a source code access method provided in Embodiment 3 of this application. This embodiment is mainly an extension of the source code access method described in Embodiment 1 above, such as... Figure 3 As shown, the method may include, but is not limited to, the following steps:
[0078] Step S31: In response to the browser's page access request, load the production code and send the production code to the browser. The production code is obtained by hiding the source code.
[0079] Step S32: In response to the browser's source code retrieval request, if the pseudo path of the source code is obtained from the source code retrieval request, the pseudo path of the source code is sent to the reverse proxy server so that the reverse proxy server can find the real path that matches the pseudo path of the source code. If a match is found, the real path is returned to the backend server.
[0080] The pseudo path of the source code is determined in the following way: when the browser responds to the source code debugging request and obtains the key field from the source code debugging request, it generates the pseudo path of the source code based on the path of the production code and the key value corresponding to the key field.
[0081] Step S33: Based on the real path, obtain the source code and return the source code to the browser.
[0082] For detailed procedures of steps S31-S33, please refer to the relevant description of steps S11-S13 in Example 1, which will not be repeated here.
[0083] Step S34: If the reverse proxy server returns a matching failure message indicating that it has not found a real path that matches the pseudo path of the source code, access the space corresponding to the pseudo path of the source code. If the space corresponding to the pseudo path of the source code does not contain data, return a 404 error message to the browser.
[0084] The key value in the source code debugging request sent by the user to the browser may be incorrect or obsolete. This causes the reverse proxy server to fail to find a matching real path for the pseudo path of the source code generated based on the incorrect or obsolete key value. Furthermore, the space corresponding to the pseudo path of the source code generated based on the incorrect or obsolete key value does not contain data. In this case, when the backend server receives a matching failure message from the reverse proxy server indicating that no real path matching the pseudo path of the source code has been found, it accesses the space corresponding to the pseudo path of the source code. If the space corresponding to the pseudo path of the source code does not contain data, it returns a 404 error message to the browser.
[0085] As another optional embodiment of this application, refer to Figure 4 The flowchart below shows a source code access method provided in Embodiment 4 of this application. This method can be applied to a browser and may include the following steps:
[0086] Step S41: Send a page access request to the backend server so that the backend server responds to the page access request, loads the production code, and sends the production code to the browser. The production code is obtained by hiding the source code.
[0087] Step S42: Receive the production code.
[0088] Step S43: In response to the source code debugging request, if a key field is obtained from the source code debugging request, a pseudo path of the source code is generated based on the path of the production code and the key value corresponding to the key field.
[0089] Step S44: Send a source code retrieval request carrying the pseudo path of the source code to the backend server, so that the backend server responds to the source code retrieval request of the browser. If the pseudo path of the source code is obtained from the source code retrieval request, the pseudo path of the source code is sent to the reverse proxy server, so that the reverse proxy server finds the real path that matches the pseudo path of the source code. If a match is found, the real path is returned to the backend server. The backend server retrieves the source code based on the real path and returns the source code to the browser.
[0090] The detailed process of steps S43-S44 can be found in the relevant description in Example 1, and will not be repeated here.
[0091] The source code access device provided in this application will be described below. The source code access device described below can be referred to in correspondence with the source code access method described above.
[0092] like Figure 5 As shown, the source code access device is applied to the backend server. The source code access device includes: a first response module 100, a second response module 200, an acquisition module 300, and a first return module 400.
[0093] The first response module 100 is used to respond to a browser's page access request, load production code, and send the production code to the browser. The production code is obtained by hiding the source code.
[0094] The second response module 200 is used to respond to the browser's source code acquisition request. If a pseudo path of the source code is obtained from the source code acquisition request, the pseudo path of the source code is sent to the reverse proxy server so that the reverse proxy server can find the real path that matches the pseudo path of the source code. If a match is found, the real path is returned to the backend server.
[0095] The pseudo path of the source code is determined in the following way: when the browser responds to the source code debugging request and obtains the key field from the source code debugging request, it generates the pseudo path of the source code based on the path of the production code and the key value corresponding to the key field.
[0096] The acquisition module 300 is used to acquire the source code based on the real path;
[0097] The first return module 400 is used to return the source code to the browser.
[0098] In this embodiment, the device may further include:
[0099] The sending module is configured to send the real path of the source code to the reverse proxy server if the pseudo path of the source code is not obtained from the source code acquisition request, but the real path of the source code is obtained from the source code acquisition request, so that the reverse proxy server maps the real path of the source code to the target path and returns the target path to the backend server, wherein the data corresponding to the target path does not contain the source code at least.
[0100] The second return module is used to return the data corresponding to the target path to the browser.
[0101] In this embodiment, the data corresponding to the target path may include a 404 error message.
[0102] In this embodiment, the device may further include:
[0103] The third return module is used to access the space corresponding to the pseudo path of the source code when the reverse proxy server returns a matching failure message indicating that no real path matching the pseudo path of the source code has been found. If the space corresponding to the pseudo path of the source code does not contain data, a 404 error message is returned to the browser.
[0104] In another embodiment of this application, a source code access device is provided, applied to a browser, such as... Figure 6 As shown, the device includes: a first transmitting module 500, a receiving module 600, a generating module 700, and a second transmitting module 800.
[0105] The first sending module 500 is used to send a page access request to the backend server, so that the backend server responds to the page access request, loads production code, and sends the production code to the browser. The production code is obtained by hiding the source code.
[0106] Receiver module 600 is used to receive the production code;
[0107] The generation module 700 is configured to, in response to a source code debugging request, generate a pseudo path for the source code based on the path of the production code and the key value corresponding to the key field, provided that a key field is obtained from the source code debugging request.
[0108] The second sending module 800 is used to send a source code retrieval request carrying a pseudo path of the source code to the backend server, so that the backend server responds to the source code retrieval request of the browser. If the pseudo path of the source code is obtained from the source code retrieval request, the pseudo path of the source code is sent to the reverse proxy server, so that the reverse proxy server finds the real path that matches the pseudo path of the source code. If a match is found, the real path is returned to the backend server. The backend server retrieves the source code based on the real path and returns the source code to the browser so that the browser can debug the source code.
[0109] It should be noted that each embodiment focuses on describing the differences from other embodiments, and the same or similar parts between the embodiments can be referred to accordingly. For the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments.
[0110] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or electronic device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or electronic device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or electronic device that includes said element.
[0111] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.
[0112] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer electronic device (which may be a personal computer, server, or network electronic device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0113] The above provides a detailed description of the source code access method and apparatus provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A source code access method characterized by, Applied to backend servers, the method includes: In response to a browser's page access request, the production code is loaded and sent to the browser. The production code is obtained by hiding the source code. When the backend server specifies a key value, the backend server generates a pseudo path of the source code based on the path of the production code and the key value corresponding to the key field, and sends the pseudo path of the source code and the real path of the source code to the reverse proxy server so that the reverse proxy server can configure the mapping relationship between the pseudo path of the source code and the real path. In response to the browser's source code retrieval request, if a pseudo path of the source code is obtained from the source code retrieval request, the pseudo path of the source code is sent to the reverse proxy server so that the reverse proxy server can find the real path that matches the pseudo path of the source code in the configured mapping relationship. If a match is found, the real path is returned to the backend server. The pseudo path of the source code is determined in the following way: when the browser responds to the source code debugging request and obtains the key field from the source code debugging request, it generates the pseudo path of the source code based on the path of the production code and the key value corresponding to the key field. Based on the actual path, the source code is obtained and returned to the browser.
2. The method according to claim 1, characterized in that, Following the response to the browser's source code retrieval request, the method further includes: If the pseudo path of the source code is not obtained from the source code retrieval request, but the real path of the source code is obtained from the source code retrieval request, then the real path of the source code is sent to the reverse proxy server, so that the reverse proxy server maps the real path of the source code to the target path and returns the target path to the backend server, and the data corresponding to the target path does not contain the source code at least; Return the data corresponding to the target path to the browser.
3. The method according to claim 2, characterized in that, The data corresponding to the target path contains a 404 error message.
4. The method according to claim 1, characterized in that, If the reverse proxy server returns a matching failure message indicating that it has not found a real path that matches the pseudo path of the source code, it accesses the space corresponding to the pseudo path of the source code. If the space corresponding to the pseudo path of the source code does not contain data, it returns a 404 error message to the browser.
5. A source code access method, characterized in that, Applied to a browser, the method includes: A page access request is sent to the backend server, so that the backend server responds to the page access request, loads the production code, and sends the production code to the browser. The production code is obtained by hiding the source code. Receive the production code; In response to a source code debugging request, if a key field is obtained from the source code debugging request, a pseudo path to the source code is generated based on the path to the production code and the key value corresponding to the key field. A source code retrieval request carrying a pseudo path to the source code is sent to the backend server, so that the backend server responds to the source code retrieval request from the browser. If the pseudo path to the source code is obtained from the source code retrieval request, the pseudo path to the source code is sent to the reverse proxy server, so that the reverse proxy server searches for the real path that matches the pseudo path to the source code in the configured mapping relationship. If a match is found, the real path is returned to the backend server. The backend server retrieves the source code based on the real path and returns the source code to the browser so that the browser can debug the source code. The mapping relationship configured in the reverse proxy server is as follows: when the backend server specifies a key value, the backend server generates a pseudo path of the source code based on the path of the production code and the key value corresponding to the key field, and sends the pseudo path of the source code and the real path of the source code to the reverse proxy server, so that the reverse proxy server configures the mapping relationship between the pseudo path of the source code and the real path.
6. A source code access device, characterized in that, Applied to backend servers, the device includes: The first response module is used to respond to the browser's page access request, load the production code, and send the production code to the browser. The production code is obtained by hiding the source code. The second response module is used to respond to the browser's source code retrieval request. If the pseudo path of the source code is obtained from the source code retrieval request, the pseudo path of the source code is sent to the reverse proxy server so that the reverse proxy server can find the real path that matches the pseudo path of the source code in the configured mapping relationship. If a match is found, the real path is returned to the backend server. The pseudo path of the source code is determined in the following way: when the browser responds to the source code debugging request and obtains the key field from the source code debugging request, it generates the pseudo path of the source code based on the path of the production code and the key value corresponding to the key field. The acquisition module is used to acquire the source code based on the real path; The first return module is used to return the source code to the browser; The apparatus is further configured to: when a backend server specifies a key value, the backend server generates a pseudo path for the source code based on the path of the production code and the key value corresponding to the key field, and sends the pseudo path and the real path of the source code to the reverse proxy server, so that the reverse proxy server configures the mapping relationship between the pseudo path and the real path of the source code.
7. The apparatus according to claim 6, characterized in that, The device further includes: The sending module is configured to send the real path of the source code to the reverse proxy server if the pseudo path of the source code is not obtained from the source code acquisition request, but the real path of the source code is obtained from the source code acquisition request, so that the reverse proxy server maps the real path of the source code to the target path and returns the target path to the backend server, wherein the data corresponding to the target path does not contain the source code at least. The second return module is used to return the data corresponding to the target path to the browser.
8. The apparatus according to claim 7, characterized in that, The data corresponding to the target path contains a 404 error message.
9. The apparatus according to claim 6, characterized in that, The device further includes: The third return module is used to access the space corresponding to the pseudo path of the source code when the reverse proxy server returns a matching failure message indicating that no real path matching the pseudo path of the source code has been found. If the space corresponding to the pseudo path of the source code does not contain data, a 404 error message is returned to the browser.
10. A source code access device, characterized in that, Applied to a browser, the device includes: The first sending module is used to send a page access request to the backend server, so that the backend server responds to the page access request, loads the production code, and sends the production code to the browser. The production code is obtained by hiding the source code. A receiving module is used to receive the production code; A generation module is used to respond to a source code debugging request and, if a key field is obtained from the source code debugging request, generate a pseudo path for the source code based on the path of the production code and the key value corresponding to the key field. The second sending module is used to send a source code retrieval request carrying a pseudo path of the source code to the backend server, so that the backend server responds to the source code retrieval request of the browser. If the pseudo path of the source code is obtained from the source code retrieval request, the pseudo path of the source code is sent to the reverse proxy server, so that the reverse proxy server searches for the real path that matches the pseudo path of the source code in the configured mapping relationship. If a match is found, the real path is returned to the backend server. The backend server retrieves the source code based on the real path and returns the source code to the browser so that the browser can debug the source code. The mapping relationship configured in the reverse proxy server is as follows: when the backend server specifies a key value, the backend server generates a pseudo path of the source code based on the path of the production code and the key value corresponding to the key field, and sends the pseudo path of the source code and the real path of the source code to the reverse proxy server, so that the reverse proxy server configures the mapping relationship between the pseudo path of the source code and the real path.