Cross-domain access method and device
By modifying the request header information in the browser and adding target authentication information, the problem of access failure caused by different domain names in cross-domain access is solved, the configuration process is simplified and the reusability is improved, and the stability and efficiency of cross-domain access are achieved. .
Patent Information
- Application Number
- CN202310308181.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-24
- Publication Date
- 2024-09-24
AI Technical Summary
During cross-domain browser access, the domain names of the front-end and server are different, resulting in the access request being unable to carry authentication information, resulting in access failure. The existing technology to configure the same domain name is cumbersome, has high maintenance costs, and has low reusability.
By modifying the request header information of the access request, the target authentication information for cross-domain access is directly added to the request header, and a new access request is generated, so that the server can identify and successfully access the corresponding server.
It simplifies the domain name configuration process, reduces maintenance costs, improves the reusability of cross-domain access, and ensures that the target authentication information in the access request can be correctly identified and used.
Smart Images

Figure CN118694550A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for cross-domain access. Background Art
[0002] When accessing some browsers, the domain name may not be carried or the front-end domain name may be different from the server domain name. Since the browser's preset security policy limits the front-end and back-end domain names, the access request cannot carry authentication information, so that the server cannot identify it based on the authentication information, resulting in access failure.
[0003] In order to solve the problem of no domain name or cross-domain access, the existing technology usually configures the same domain name for the front-end environment as the back-end to smoothly carry the authentication information, but the process of configuring the same domain name is cumbersome, which may cause the use of the same domain name in different environments to affect each other and cause it to not work properly. In addition, the maintenance cost is high, and each scenario needs to configure the domain name separately, which has low reusability. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a method and device for cross-domain access, which generates a new access request by modifying the request header information of the original access request, and directly adding the target authentication information corresponding to the first access address of the cross-domain access to the request header information, so that the server can successfully identify the target authentication information in the new access request, thereby successfully accessing the server corresponding to the first access address.
[0005] To achieve the above objective, according to one aspect of an embodiment of the present invention, a cross-domain access method is provided.
[0006] A cross-domain access method according to an embodiment of the present invention includes: obtaining an access request from a front end; obtaining a first access address corresponding to the access request from the request header information of the access request; wherein the address of the front end and the first access address correspond to different domain names; determining the target authentication information corresponding to the first access address based on the correspondence between a preset second access address and authentication information, and adding the target authentication information to the request header information to generate a new access request; sending the new access request to a server to access the server corresponding to the first access address across domains according to the access request.
[0007] Optionally, adding the target authentication information to the request header information to generate a new access request includes: adding the target authentication information to a position corresponding to cookie information in the request header to generate new request header information; and generating a new access request based on the new request header information.
[0008] Optionally, the target authentication information includes the cookie information of the front end; the target authentication information is added to the position corresponding to the cookie information in the request header to generate new request header information, including: processing the cookie information of the front end to generate a key-value pair with the first access address as the key and the cookie information of the front end as the value; merging multiple front-end cookie information corresponding to multiple identical key values, and adding the merged result to the position corresponding to the cookie information in the request header.
[0009] Optionally, the method also includes at least one of the following: configuring multiple second access addresses through a front-end display interface, and configuring the correspondence between each second access address and one or more preset authentication information; recording the access request, the access address, and the new request header information; and displaying the recorded information through the front-end display interface in response to a query request.
[0010] Optionally, determining the target authentication information corresponding to the first access address includes: determining whether there is a target second access address in the second access address that is the same as the first access address; if the target second access address exists, determining one or more target authentication information corresponding to the target second access address based on the corresponding relationship.
[0011] Optionally, before determining the target authentication information corresponding to the first access address according to the correspondence between the preset second access address and the authentication information, it also includes: confirming whether the system cross-domain access function is enabled; if so, executing the step of determining the target authentication information corresponding to the first access address according to the correspondence between the preset second access address and the authentication information; otherwise, directly sending the access request to the server to access the server according to the access request.
[0012] Optionally, the method also includes: setting the activation status of the cross-domain access function of multiple second access addresses through the front-end display interface; after determining the target authentication information, confirming whether to generate a new access request based on the activation status of the cross-domain access function corresponding to the first access address.
[0013] To achieve the above objective, according to another aspect of an embodiment of the present invention, a device for cross-domain access is provided.
[0014] A cross-domain access device according to an embodiment of the present invention comprises: an acquisition module, configured to acquire an access request from a front end; and acquire a first access address corresponding to the access request from request header information of the access request; wherein the address of the front end and the first access address correspond to different domain names;
[0015] A generating module, configured to determine target authentication information corresponding to the first access address according to a preset correspondence between the second access address and the authentication information, and add the target authentication information to the request header information to generate a new access request;
[0016] The sending module is used to send the new access request to the server, so as to access the server corresponding to the first access address across domains according to the access request.
[0017] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device for cross-domain access is provided.
[0018] An electronic device for cross-domain access according to an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement a cross-domain access method according to an embodiment of the present invention.
[0019] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided.
[0020] A computer-readable storage medium according to an embodiment of the present invention stores a computer program, and when the program is executed by a processor, a cross-domain access method according to an embodiment of the present invention is implemented.
[0021] An embodiment of the above invention has the following advantages or beneficial effects: by modifying the request header information of the original access request, the target authentication information corresponding to the first access address of the cross-domain access is directly added to the request header information, and a new access request is generated, so that the server can successfully identify the target authentication information in the new access request, thereby successfully accessing the server corresponding to the first access address.
[0022] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0024] Figure 1 is a flow chart of a method for cross-domain access according to an embodiment of the present invention;
[0025] Figure 2 is a schematic diagram of a process for determining target authentication information corresponding to a first access address according to an embodiment of the present invention;
[0026] Figure 3is a schematic diagram of a process of generating a new access request according to an embodiment of the present invention;
[0027] Figure 4 is a schematic diagram of a process of adding target authentication information to request header information according to an embodiment of the present invention;
[0028] Figure 5 is a schematic diagram of a process for determining whether to enable a cross-domain access function according to an embodiment of the present invention;
[0029] Figure 6 is a schematic diagram of main modules of a device for cross-domain access according to an embodiment of the present invention;
[0030] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0031] Figure 8 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0032] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0033] It should be pointed out that the embodiments of the present invention and the technical features therein may be combined with each other without conflict.
[0034] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0035] Figure 1 It is a schematic diagram of main steps of the method for cross-domain access according to an embodiment of the present invention.
[0036] like Figure 1 As shown, the cross-domain access method of the embodiment of the present invention mainly includes the following steps:
[0037] Step S101: Obtaining an access request from the front end;
[0038] Step S102: acquiring a first access address corresponding to the access request from the request header information of the access request; wherein the front-end address and the first access address correspond to different domain names;
[0039] Step S103: determining the target authentication information corresponding to the first access address according to the preset correspondence between the second access address and the authentication information, and adding the target authentication information to the request header information to generate a new access request;
[0040] Step S104: Send a new access request to the server to access the server corresponding to the first access address across domains according to the access request.
[0041] The browser usually sends an access request to access the backend server, so the front end can be understood as the browser end and the back end as the server end. The first access address is the address of the backend server to be accessed. Since the address of the front-end browser and the address of the backend server to be accessed correspond to different domain names, the original request header information needs to be modified.
[0042] It should be noted that the present invention focuses on application in development and joint debugging environments. Compared with the formal application environment, the development and joint debugging environment is limited to developers accessing the first access address with permission, so the parsing rules can be configured in advance for the front and back ends, so as to smoothly parse and obtain the target authentication information from the new access request. The formal application environment is usually a third-party website, which involves http specification issues. There may be problems such as failure to add request headers and access failures, and the third-party website needs to obtain the corresponding parsing rules in advance, otherwise there will be cookie confusion. Therefore, if the method provided in the embodiment of the present invention is applied to the formal application environment, it requires the third party to perform relevant configurations before it can be implemented.
[0043] In an optional embodiment, step S102 may include: using the callback function to obtain request header information from the access request, and obtaining the first access address corresponding to the access request by regular matching the requestUrl in the request header. The first access address may be understood as an IP address.
[0044] The correspondence between the preset second access address and the authentication information in step S103 needs to be configured in advance. In an optional embodiment, multiple second access addresses can be configured through the front-end display interface, and the correspondence between each second access address and one or more preset authentication information can be configured. In general, the configured second access address can be considered to be a credible and secure IP address that will not cause malicious access. In order to facilitate the subsequent matching process of the first access address and the second access address, in a further optional embodiment, the second access address and the authentication relationship can be stored in the database in the form of key name-key value, that is, in the subsequent matching process, the corresponding key value can be obtained by matching the key name.
[0045] In an optional embodiment, the process of determining the target authentication information corresponding to the first access address in step S103 can be as follows: Figure 2 As shown, specifically including:
[0046] Step S201: determining whether there is a target second access address that is the same as the first access address in the second access address;
[0047] If the target second access address exists, executing step S202: determining one or more target authentication information corresponding to the target second access address according to the corresponding relationship;
[0048] In the case that the target second access address does not exist, step S203 is executed: the access request is directly sent to the server to access the server according to the access request.
[0049] Through the above process, when there is a target second access address, the target authentication information can be directly obtained according to the pre-configured correspondence relationship without adding a domain name to the first access address. The configuration is simpler, maintenance is convenient, and reusability is high. It is applicable to all qualified first-level domain names.
[0050] After obtaining the target authentication information corresponding to the first access address, the target authentication information can be added to the request header information. The specific process is as follows: Figure 3 As shown, including:
[0051] Step S301: Add the target authentication information to the position corresponding to the cookie information in the request header to generate new request header information;
[0052] Step S302: Generate a new access request according to the new request header information.
[0053] Specifically, the target authentication information is one or more of the multiple cookie information of the front end, wherein the cookie information of the front end can be understood as all the cookie information of the current browser. In an optional embodiment, the storage of the cookie information can be stored in JSON format, which is more convenient for maintenance. In a further optional embodiment of step S301, it can be as follows Figure 4 As shown, including:
[0054] Step S401: Process the cookie information of the front end to generate a key-value pair with the first access address as the key and the cookie information of the front end as the value;
[0055] Step S402: merge the cookie information of multiple front ends corresponding to multiple identical key values, and add the merged result to the position corresponding to the cookie information in the request header.
[0056] Through the above process, the target authentication information corresponding to the first access address can be obtained from the trusted cookie information browsed by the browser, and then the target authentication information is merged in the form of key-value pairs, and the merged result is added to the position corresponding to the cookie information in the request header to generate a new access request containing the target authentication information.
[0057] In an optional embodiment, all operation information performed by each access request is recorded in a log, that is, the access request, access address, and new request header information are recorded, so that in response to the query request, the recorded information is displayed through the front-end display interface. Specifically, in the log management, the generation process of each new access request can be recorded, which can specifically include the first access address, the second access address, the target authentication information, the access time, the access result (whether successful), and the error message, etc. By recording the operation in the log management, when the subsequent new access request is not successfully accessed, the record query can be performed to quickly determine the reason for the access failure. Among them, common error messages include: cookie information is not obtained, cookie information cannot be parsed, and request sending fails. Therefore, in an optional embodiment, the log management can be queried according to the preset time period, and the error message can be obtained from the log, and the problem analysis is performed according to the error message, so as to iteratively update the cross-domain access method provided by the embodiment of the present invention.
[0058] In a further optional embodiment, before determining the target authentication information corresponding to the first access address, it can be determined whether the cross-domain access function is enabled, and the access request is regenerated for the IP that requires cross-domain access, while for the access request that does not require cross-domain access, direct access is sufficient. Figure 5 As shown, including:
[0059] Step S501: confirm whether to enable the system cross-domain access function;
[0060] If yes, executing step S502: determining the target authentication information corresponding to the first access address according to the preset correspondence between the second access address and the authentication information;
[0061] Otherwise, execute step S503: directly send the access request to the server to access the server according to the access request.
[0062] Among them, the system cross-domain function can be equivalent to a switch of system permissions. When the system cross-domain access function is turned on, step S502 is executed for each access request after it is turned on. In another optional embodiment, the cross-domain access function of each second access address can also be preset separately, that is, a separate permission control is performed. When the system permission is turned on, whether to execute step S502 is determined according to the separate permission. Specifically including: setting the activation status of the cross-domain access function of multiple second access addresses through the front-end display interface; after determining the target authentication information, confirming whether to generate a new access request according to the activation status of the cross-domain access function corresponding to the first access address.
[0063] It should be noted that the cross-domain access method provided by the present invention can be implemented in the form of a plug-in. By installing the plug-in on one end of the browser (front end) and successfully starting the plug-in, the access request can be obtained when the front end sends an access request, and a series of operations can be performed to finally send the new access request to the server.
[0064] According to the cross-domain access method of an embodiment of the present invention, by modifying the request header information of the original access request, the target authentication information corresponding to the first access address of the cross-domain access is directly added to the request header information, and a new access request is generated, so that the server can successfully identify the target authentication information in the new access request, thereby successfully accessing the server corresponding to the first access address.
[0065] Figure 6 4 is a schematic diagram of main modules of a device for cross-domain access according to an embodiment of the present invention.
[0066] like Figure 6 As shown, the cross-domain access device 600 of the embodiment of the present invention includes:
[0067] The acquisition module 601 is used to acquire an access request from a front end; and acquire a first access address corresponding to the access request from the request header information of the access request; wherein the address of the front end and the first access address correspond to different domain names;
[0068] A generating module 602, configured to determine target authentication information corresponding to the first access address according to a preset correspondence between the second access address and the authentication information, and add the target authentication information to the request header information to generate a new access request;
[0069] The sending module 603 is used to send the new access request to the server, so as to cross-domain access the server corresponding to the first access address according to the access request.
[0070] In an optional embodiment of the present invention, the generation module 602 is further used to add the target authentication information to the position corresponding to the cookie information in the request header to generate new request header information; and generate a new access request according to the new request header information.
[0071] In an optional embodiment of the present invention, the target authentication information includes the cookie information of the front end; the generation module 602 is also used to process the cookie information of the front end to generate a key-value pair with the first access address as the key and the cookie information of the front end as the value; merge the cookie information of multiple front ends corresponding to multiple identical key values, and add the merged result to the position corresponding to the cookie information in the request header.
[0072] In an optional embodiment of the present invention, the device further includes a display module, which is used to configure multiple second access addresses through a front-end display interface, and configure a corresponding relationship between each second access address and one or more preset authentication information;
[0073] The device also includes a recording module for recording the access request, the access address, and the new request header information; in response to a query request, the recorded information is displayed through the front-end display interface.
[0074] In an optional embodiment of the present invention, the generation module 602 is also used to determine whether there is a target second access address in the second access address that is the same as the first access address; if the target second access address exists, determine one or more target authentication information corresponding to the target second access address based on the corresponding relationship.
[0075] In an optional embodiment of the present invention, the device also includes a control module, which is used to confirm whether the system cross-domain access function is enabled before determining the target authentication information corresponding to the first access address according to the correspondence between the preset second access address and the authentication information; if so, executing the step of determining the target authentication information corresponding to the first access address according to the correspondence between the preset second access address and the authentication information; otherwise, directly sending the access request to the server to access the server according to the access request.
[0076] In an optional embodiment of the present invention, the display module is also used to set the activation status of the cross-domain access function of multiple second access addresses through the front-end display interface; the generation module 602 is also used to confirm whether to generate a new access request after determining the target authentication information, based on the activation status of the cross-domain access function corresponding to the first access address.
[0077] According to the cross-domain access device of an embodiment of the present invention, the target authentication information corresponding to the first access address of the cross-domain access is directly added to the request header information by modifying the request header information of the original access request, and a new access request is generated, so that the server can successfully identify the target authentication information in the new access request, thereby successfully accessing the server corresponding to the first access address.
[0078] Figure 7 An exemplary system architecture 700 is shown to which the method for cross-domain access or the apparatus for cross-domain access according to the embodiments of the present invention may be applied.
[0079] like Figure 7 As shown, system architecture 700 may include front-end servers 701, 702, 703, a network 704, and a back-end server 705. Network 704 is used to provide a medium for communication links between front-end servers 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0080] Users can use the front-end servers 701, 702, and 703 to interact with the back-end server 705 through the network 704 to receive or send data, etc. Various communication client applications can be installed on the front-end servers 701, 702, and 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0081] The front-end servers 701, 702, 703 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0082] The backend server 705 may be a server that provides various services, such as a background management server that provides support for access requests sent by users using the front-end servers 701, 702, and 703. The background management server may analyze and process the received access requests and other data, and feed back the processing results (such as access results) to the terminal device.
[0083] It should be noted that the cross-domain access method provided in the embodiment of the present invention is generally performed by the front-end servers 701, 702, and 703, and accordingly, the cross-domain access device is generally set in the front-end servers 701, 702, and 703. When there is a proxy server between the front-end server and the back-end server, the cross-domain access device can also be set on the proxy server.
[0084] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0085] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 of a terminal device suitable for implementing an embodiment of the present invention. Figure 8 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0086] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) first interface 805 is also connected to the bus 804.
[0087] The following components are connected to the I / O first interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network first interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O first interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.
[0088] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.
[0089] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0090] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0091] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes an acquisition module, a generation module and a sending module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the acquisition module may also be described as a "module for obtaining access requests from the front end".
[0092] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining an access request from a front end; obtaining a first access address corresponding to the access request from the request header information of the access request; wherein the address of the front end and the first access address correspond to different domain names; determining the target authentication information corresponding to the first access address according to the correspondence between the preset second access address and the authentication information, and adding the target authentication information to the request header information to generate a new access request; sending the new access request to the server to access the server corresponding to the first access address across domains according to the access request.
[0093] According to the technical solution of an embodiment of the present invention, by modifying the request header information of the original access request, the target authentication information corresponding to the first access address of the cross-domain access is directly added to the request header information, and a new access request is generated, so that the server can successfully identify the target authentication information in the new access request, thereby successfully accessing the server corresponding to the first access address.
[0094] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A cross-domain access method, characterized in that: include: Get access request from the front end; Acquire a first access address corresponding to the access request from the request header information of the access request; wherein the address of the front end and the first access address correspond to different domain names; Determine the target authentication information corresponding to the first access address according to the preset correspondence between the second access address and the authentication information, and add the target authentication information to the request header information to generate a new access request; The new access request is sent to the server, so as to access the server corresponding to the first access address across domains according to the access request.
2. The method according to claim 1, characterized in that The adding the target authentication information to the request header information to generate a new access request includes: Add the target authentication information to the position corresponding to the cookie information in the request header to generate new request header information; Generate a new access request according to the new request header information.
3. The method according to claim 2, characterized in that The target authentication information includes the cookie information of the front end; the adding the target authentication information to the position corresponding to the cookie information in the request header to generate new request header information includes: Processing the cookie information of the front end to generate a key-value pair with the first access address as the key and the cookie information of the front end as the value; The cookie information of multiple front ends corresponding to multiple identical key values are merged, and the merged result is added to the position corresponding to the cookie information in the request header.
4. The method according to claim 1, characterized in that: Also includes at least one of the following: Configure multiple second access addresses through the front-end display interface, and configure the corresponding relationship between each second access address and one or more preset authentication information; The access request, the access address, and the new request header information are recorded; and in response to a query request, the recorded information is displayed through the front-end display interface.
5. The method according to claim 4, characterized in that The determining the target authentication information corresponding to the first access address includes: Determine whether there is a target second access address that is the same as the first access address in the second access address; In the case where the target second access address exists, one or more target authentication information corresponding to the target second access address is determined according to the corresponding relationship.
6. The method according to claim 1, characterized in that Before determining the target authentication information corresponding to the first access address according to the preset correspondence between the second access address and the authentication information, the method further includes: Confirm whether to enable the system cross-domain access function; If yes, executing the step of determining the target authentication information corresponding to the first access address according to the preset correspondence between the second access address and the authentication information; Otherwise, the access request is directly sent to the server to access the server according to the access request.
7. The method according to claim 6, characterized in that Also includes: Setting the cross-domain access function enabling status of the plurality of second access addresses through the front-end display interface; After the target authentication information is determined, whether to generate a new access request is determined according to the activation status of the cross-domain access function corresponding to the first access address.
8. A cross-domain access device, characterized in that: include: The acquisition module is used to obtain access requests from the front end; Acquire a first access address corresponding to the access request from the request header information of the access request; wherein the address of the front end and the first access address correspond to different domain names; A generating module, configured to determine target authentication information corresponding to the first access address according to a preset correspondence between the second access address and the authentication information, and add the target authentication information to the request header information to generate a new access request; The sending module is used to send the new access request to the server, so as to access the server corresponding to the first access address across domains according to the access request.
9. An electronic device for cross-domain access, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
