CN114640718A - Data processing method and device based on data processing system - Google Patents

Data processing method and device based on data processing system Download PDF

Info

Publication number
CN114640718A
CN114640718A CN202210275874.2A CN202210275874A CN114640718A CN 114640718 A CN114640718 A CN 114640718A CN 202210275874 A CN202210275874 A CN 202210275874A CN 114640718 A CN114640718 A CN 114640718A
Authority
CN
China
Prior art keywords
data
domain
target
cross
domain name
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210275874.2A
Other languages
Chinese (zh)
Other versions
CN114640718B (en
Inventor
黄湘龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Cloud Computing Ltd
Original Assignee
Alibaba Cloud Computing Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Cloud Computing Ltd filed Critical Alibaba Cloud Computing Ltd
Priority to CN202210275874.2A priority Critical patent/CN114640718B/en
Publication of CN114640718A publication Critical patent/CN114640718A/en
Application granted granted Critical
Publication of CN114640718B publication Critical patent/CN114640718B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways

Abstract

The application provides a data processing method and device based on a data processing system. The data server may not perform the aforementioned action of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name", where the data server is usually allowed to provide the cross-domain data service according to the cross-domain data request as long as the data server receives the cross-domain data request forwarded by the gateway, so that the action of "generating a cross-domain data response according to the cross-domain data request, and returning the cross-domain data response to the terminal" may be directly performed, and the efficiency of providing the data service to the outside in the cross-domain manner by the data server may be improved. In addition, the workload of workers can be reduced, and the labor cost is reduced. And secondly, the logic of the data server can be simplified, and the management and maintenance cost of the data server in the later period is reduced.

Description

Data processing method and device based on data processing system
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data processing method and apparatus based on a data processing system.
Background
With the rapid development of the technology, the browser is used as a main carrier when the terminal surfs the internet and watches videos. For security reasons, the browser restricts cross-domain data requests originating from the script. The default security restriction is a same-origin policy (same-origin policy), that is, JavaScript or Cookie can only access content in the same domain, for example, in the case that a user accesses a network resource through a browser, the browser security mechanism requires that the protocol, domain name, and port of the resource must be consistent with the source station to enable normal access. These limitations, however, sometimes introduce a number of inconveniences and affect the rational utility. For example, for medium and large internet comprehensive websites, because services are developed and classified, a plurality of domain names exist at the same time to correspond to different services, and users often have a cross-domain access requirement when using a browser to normally access the comprehensive website.
As such, cross-domain access needs to be supported. For example, it is necessary to support cross-domain request on a page of one domain name for a server corresponding to another domain name to provide data services.
Disclosure of Invention
The application discloses a data processing method and device based on a data processing system.
In a first aspect, the present application shows a data processing method based on a data processing system, the system comprising: the method is applied to the gateway and comprises the following steps:
receiving a cross-domain data request sent by a terminal based on a page of a first domain name, wherein the cross-domain data request at least carries a target service interface and the first domain name, and the target service interface comprises: a service interface which is opened to the outside by a target data service end in at least one data service end and provides a target type of data service to the outside; the cross-domain data request is used for requesting a target data server to provide a target type data service corresponding to a target service interface based on a page cross-domain of a first domain name;
determining whether a target data server allows a page cross-domain request based on a first domain name to provide a target type data service corresponding to a target service interface or not according to the target service interface and the first domain name;
and under the condition that a page cross-domain request target data server based on the first domain name is allowed to provide a target type data service corresponding to the target service interface, forwarding the cross-domain data request to the target data server.
In a second aspect, the present application shows a data processing method based on a data processing system, the system comprising: the method is applied to a target data server in the at least one data server, and comprises the following steps:
receiving a cross-domain data request sent by the gateway;
the cross-domain data request at least carries a target service interface and a first domain name, and the target service interface comprises: a service interface which is opened to the outside by a target data service end in at least one data service end and provides a target type of data service to the outside; the cross-domain data request is used for requesting a target data server to provide a target type data service corresponding to a target service interface based on a page cross-domain of a first domain name; the cross-domain data request is sent to the gateway by the terminal based on the page of the first domain name, and is sent to the target data server by the gateway under the condition that the gateway determines that the target data server allows the page based on the first domain name to request the target data server to provide the target type of data service corresponding to the target service interface in a cross-domain mode according to the target service interface and the first domain name;
extracting a target service interface in the cross-domain data request;
and generating a data response according to the data processing logic of the data service corresponding to the target service interface.
In a third aspect, the present application shows a data processing apparatus based on a data processing system, the system comprising: the gateway and at least one data server, the communication connection between gateway and each data server, the device is applied to the gateway, the device includes:
a first receiving module, configured to receive a cross-domain data request sent by a terminal based on a page of a first domain name, where the cross-domain data request at least carries a target service interface and the first domain name, and the target service interface includes: a service interface which is opened to the outside by a target data service end in at least one data service end and provides a target type of data service to the outside; the cross-domain data request is used for requesting a target data server to provide a target type data service corresponding to a target service interface based on a page cross-domain of a first domain name;
the first determining module is used for determining whether the target data server allows the page cross-domain request based on the first domain name to provide the data service of the target type corresponding to the target service interface by the target data server according to the target service interface and the first domain name;
and the forwarding module is used for forwarding the cross-domain data request to the target data server under the condition that the target data server is allowed to provide the target type data service corresponding to the target service interface based on the page cross-domain request of the first domain name.
In a fourth aspect, the present application shows a data processing apparatus based on a data processing system, the system comprising: the gateway and at least one data server, the gateway and each data server communication connection, the device is applied to at least one data server in the target data server, the device includes:
a third receiving module, configured to receive a cross-domain data request sent by the gateway;
the cross-domain data request at least carries a target service interface and a first domain name, and the target service interface comprises: a service interface which is opened to the outside by a target data service end in at least one data service end and provides a target type of data service to the outside; the cross-domain data request is used for requesting a target data server to provide a target type data service corresponding to a target service interface based on a page cross-domain of a first domain name; the cross-domain data request is sent to the gateway by the terminal based on the page of the first domain name, and is sent to the target data server by the gateway under the condition that the gateway determines that the target data server allows the page based on the first domain name to request the target data server to provide the target type of data service corresponding to the target service interface in a cross-domain mode according to the target service interface and the first domain name;
the extraction module is used for extracting a target service interface in the cross-domain data request;
and the generating module is used for generating a data response according to the data processing logic of the data service corresponding to the target service interface.
In a fifth aspect, the present application illustrates an electronic device comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform a method as shown in any of the preceding aspects.
In a sixth aspect, the present application illustrates a non-transitory computer readable storage medium having instructions which, when executed by a processor of an electronic device, enable the electronic device to perform a method as in any one of the preceding aspects.
In a seventh aspect, the present application shows a computer program product, wherein instructions of the computer program product, when executed by a processor of an electronic device, enable the electronic device to perform the method as shown in any one of the preceding aspects.
Compared with the prior art, the method has the following advantages:
in the application, the data server may not perform the aforementioned action of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name", where the data server is allowed to provide the cross-domain data service according to the cross-domain data request as long as the data server receives the cross-domain data request forwarded by the gateway, so that an action of "generating a cross-domain data response according to the cross-domain data request, and returning the cross-domain data response to the terminal" may be directly performed, and the efficiency of providing the data service to the outside in the cross-domain manner by the data server may be improved.
In addition, since the data server may not perform the aforementioned action of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name", it is possible to determine whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name without configuring the function of "extracting the domain name in the Origin field in the cross-domain data request" in the data server. Secondly, the logic of the data server can be simplified, the management and maintenance cost of the data server in the later period can be reduced, and the occupation of system resources (such as storage resources, computing resources and the like) of the data server can be reduced, so that the data server can centralize more system resources in the aspects of obtaining input data (cross-domain data requests), then processing the input data to obtain output data (generating cross-domain data responses according to the cross-domain data requests), and outputting the output data (returning the cross-domain data responses to the terminal), the concurrency of the data server can be improved, and the efficiency of the data server for providing data services to the outside in a cross-domain mode can be further improved.
Drawings
FIG. 1 is a block diagram of a data processing system according to the present application.
FIG. 2 is a flow chart illustrating the steps of a data processing method of the present application based on a data processing system.
FIG. 3 is a flow chart of the steps of a data processing method based on a data processing system of the present application.
Fig. 4 is a block diagram of a data processing apparatus based on a data processing system according to the present application.
Fig. 5 is a block diagram of a data processing apparatus based on a data processing system according to the present application.
Fig. 6 is a block diagram of a device of the present application.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, the present application is described in further detail with reference to the accompanying drawings and the detailed description.
In order to support Cross-domain access, various schemes such as CORS (Cross Origin Resource Sharing) may be adopted to implement Cross-domain access.
Taking CORS as an example: under the condition that a server corresponding to another domain name is required to provide data service in a cross-domain manner on a page of the domain name, the terminal can add an Origin field in a request header of a cross-domain data request and store the domain name in the Origin field; after receiving a cross-domain data request, the server extracts the domain name in the Origin field in the cross-domain data request, judges whether the server corresponding to another domain name is allowed to provide data service in a cross-domain manner on the page of the domain name, and generates a cross-domain data response according to the cross-domain data request and returns the cross-domain data response to the terminal under the condition that the server corresponding to another domain name is allowed to provide data service in the cross-domain manner on the page of the domain name, so that the purpose that the terminal requests the server corresponding to another domain name to provide data service in the cross-domain manner on the page of the domain name is achieved.
The inventors have analyzed the above-described method and found that the above-described method has the following problems:
the server needs to execute an action of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the server corresponding to another domain name to provide data service on the page of the domain name in a cross-domain manner". The task that the worker needs to configure the function of "extracting the domain name in the Origin field in the cross-domain data request and determining whether to allow the server corresponding to the other domain name to provide data service in the cross-domain on the page of the domain name" in the server (for example, writing the computer program code and configuring the related interface for "extracting the domain name in the Origin field in the cross-domain data request and determining whether to allow the server corresponding to the other domain name to provide data service in the cross-domain on the page of the domain name") results in more complicated logic of the server, high management and maintenance costs for the server in the later period, and the action of executing "extracting the domain name in the Origin field in the cross-domain data request and determining whether to allow the server corresponding to the other domain name to provide data service in the page of the domain name" occupies system resources of the server(s) For example, storage resources and computing resources, etc.), which results in that the server cannot concentrate more system resources on the aspect of "generating a cross-domain data response according to a cross-domain data request", the concurrency of the server is reduced, and the efficiency of the server providing data services to the outside in a cross-domain manner is reduced.
Secondly, in the scenario of the distributed system, the distributed system includes a plurality of servers, and a worker configures, in each server in the distributed system, the function of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the server corresponding to another domain name to provide data service on the page of the domain name in a cross-domain manner" in advance, which increases the workload of the worker. Moreover, the server used in the above manner is often a server of nginnx, and the function of "extracting the domain name in the Origin field in the cross-domain data request and determining whether to allow the server corresponding to another domain name to provide data service on the page of the domain name in a cross-domain manner" needs to use command line configuration, so that the configuration complexity is high, the difficulty is high, and the later operation and maintenance cost is high. Resulting in high labor costs.
In view of this, the demands of "improving the efficiency of providing data services to the outside across domains and reducing the labor cost of workers in the scene of providing data services to the terminals across domains at the server side of the distributed system" are provided.
In order to improve the efficiency of the service end for providing data service to the outside in a cross-domain manner and reduce the labor cost of workers in a scene that the service end of the distributed system provides data service to the terminal in a cross-domain manner, the inventor finds out that:
in the above manner, from the perspective of the server in the distributed system, the server performs the following operations:
the server receives the cross-domain data request, extracts the domain name in the Origin field in the cross-domain data request, and judges whether to allow the server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name. And under the condition that a server corresponding to another domain name is allowed to provide data service by requesting the page of the domain name in a cross-domain manner, generating a cross-domain data response according to the cross-domain data request, and returning the cross-domain data response to the terminal.
Through analysis, the action executed by the server can be divided into two stages:
a stage of: the server receives the cross-domain data request, extracts the domain name in the Origin field in the cross-domain data request, and judges whether to allow the server corresponding to another domain name to provide data service on the page of the domain name in a cross-domain manner.
And the other stage is as follows: and the server generates a cross-domain data response according to the cross-domain data request and returns the cross-domain data response to the terminal.
The inventor further finds that, in the above another phase, the action of "generating a cross-domain data response according to a cross-domain data request and returning the cross-domain data response to the terminal" often needs to be performed by the server itself. That is, for the server, it is necessary to obtain input data (a cross-domain data request), process the input data to obtain output data (a cross-domain data response is generated according to the cross-domain data request), and output the output data (a cross-domain data response is returned to the terminal).
And for the action of "extracting the domain name in the Origin field in the cross-domain data request, judging whether to allow a server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name" may not be executed by the server.
That is, the action of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the server corresponding to another domain name to provide data service on the page of the domain name in a cross-domain manner" is not necessarily performed by the server.
In view of this, the inventor has conceived that the "logic for extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name" may be decoupled from the server.
Therefore, the function of extracting the domain name in the Origin field in the cross-domain data request and judging whether to allow the service end corresponding to the other domain name to provide data service on the page of the domain name in a cross-domain mode to be requested or not can be configured in the service end, so that the workload of workers can be reduced, and the labor cost can be reduced.
Secondly, due to decoupling, logic of the server can be simplified, management and maintenance cost of the server in the later period is reduced, and occupation of system resources (such as storage resources and computing resources) of the server is reduced, so that the server can centralize more system resources to obtain input data (cross-domain data requests), then process the input data to obtain output data (cross-domain data responses are generated according to the cross-domain data requests), and output data (cross-domain data responses are returned to the terminal), thereby improving concurrency of the server and further improving efficiency of providing data services to the outside in a cross-domain manner by the server.
In order to decouple the logic of "extracting the domain name in the Origin field in the cross-domain data request, judging whether to allow a server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name" from the server ", the inventors found that, because the logic of" extracting the domain name in the Origin field in the cross-domain data request, judging whether to allow the server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name "is in the order of" obtaining input data (cross-domain data request), then processing the input data to obtain output data (generating cross-domain data response according to the cross-domain data request), and outputting the output data (returning the cross-domain data response to the terminal) ".
That is, it is required to perform an action of "extracting the domain name in the Origin field in the cross-domain data request, determining whether to allow the server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name" and then perform an action of "obtaining input data (the cross-domain data request)," then processing the input data to obtain output data (generating a cross-domain data response according to the cross-domain data request), and outputting the output data (returning the cross-domain data response to the terminal) ".
In view of this, the inventors thought of providing middleware, such as a gateway or the like, at a logical level between the application and the server side of the distributed system.
The gateway may be configured with a function of "extracting the one domain name in the Origin field in the cross-domain data request, and determining whether to allow a server corresponding to another domain name to provide data services in a cross-domain manner on a page of the one domain name", that is, configured with a logic of "extracting the one domain name in the Origin field in the cross-domain data request, and a logic of" allowing a server corresponding to another domain name to provide data services in a cross-domain manner on a page of the one domain name ", so that the gateway may perform an action of" extracting the one domain name in the Origin field in the cross-domain data request, and determining whether to allow a server corresponding to another domain name to provide data services in a cross-domain manner on a page of the one domain name ".
Specifically, referring to FIG. 1, a block diagram of a data processing system of the present application is shown, the system comprising:
the terminal 01 and the distributed system, the distributed system includes at least one gateway 02 and at least one data server 03.
The terminal is in communication connection with each gateway, and data interaction can be carried out between the terminal and each gateway.
And each gateway is in communication connection with each data service terminal. And each gateway and each data server side can perform data interaction.
The data server has the capability of providing data services to the terminal in a cross-domain manner, for example, the server may generate a data response according to a data request sent by the terminal and return the data response to the terminal.
The terminal can interact with the data server based on a network based on a Hypertext Transfer Protocol (HTTP) or a Hypertext Transfer Protocol over secure session Layer (HTTPs).
The gateway can be used as a middleware between the terminal and the data server, and under the condition that a user uses the terminal to request the target data server to provide the data service of the target type corresponding to the target service interface based on the page cross-domain of the first domain name, the gateway can determine whether the target data server allows the page based on the first domain name to request the target data server to provide the data service of the target type corresponding to the target service interface based on the page cross-domain of the first domain name at least according to the first domain name and the target service interface; and under the condition that the page cross-domain request based on the first domain name is allowed to request the target data server to provide the data service of the target type corresponding to the target service interface, the gateway requests the target data server to provide the data service of the target type corresponding to the target service interface.
The server can provide a plurality of different types of data services to the outside. Each kind of data service has a service Interface opened to the outside, and the service Interface may include an API (Application Programming Interface) or the like.
For any kind of data service, the kind of data service has corresponding data processing logic or static resources (such as video, picture, voice or text, etc.), and when the service end provides the kind of data service to the outside, the service end can use the data processing logic corresponding to the kind of data service to process corresponding data, obtain a processing result, and obtain a data response according to the processing result. Wherein the corresponding data may include context information of the user, etc. For the kind of data service, the data service end opens a service interface to the outside for the kind of data service provided by the outside, and the terminal may request the service end to provide the kind of data service based on the service interface.
The user's context information may include the user's location, the user's profession, or the user's preferred habits, etc.
When the terminal needs to request the server to provide the data service of the type, the server may invoke the data processing logic corresponding to the data service of the type according to the service interface corresponding to the data service of the type provided by the terminal, and process corresponding data based on the data processing logic corresponding to the data service of the type, so as to provide the data service of the type to the terminal.
The same is true for every other kind of data service.
The data processing logic may be different for different kinds of data services. The APIs that are open to the outside for different kinds of data services may be different.
Specifically, referring to fig. 2, a flow chart of a data processing method based on a data processing system according to the present application is shown, where the method is applied to the gateway shown in fig. 1, and the method includes:
in step S101, a cross-domain data request sent by a receiving terminal based on a page of a first domain name is received, where the cross-domain data request at least carries a target service interface and the first domain name, and the target service interface includes: a service interface which is opened to the outside by a target data service end in at least one data service end and provides a target type of data service to the outside; the cross-domain data request is used for requesting a target data server to provide a target type of data service corresponding to a target service interface in a cross-domain mode based on a page of a first domain name.
The domain name of the target data server may be different from the first domain name, etc.
In the application, the terminal may be installed with an application program, the application program may include a browser, and the terminal may interact with the gateway through the application program, and the terminal may store, in advance, service interfaces corresponding to various types of data services provided by the target data service terminal to the outside through the application program. Therefore, the terminal can use the application program to request the target data server to provide the corresponding data service according to the actual requirement and the service interface.
The user may browse the page using the application program in the terminal, for example, the user may control the application program of the terminal to display the page of the first domain name, in an example, the terminal may use the application program to obtain the page of the first domain name from the data service end corresponding to the first domain name, and display the page of the first domain name in the application program, however, in a case that the application program displays the page of the first domain name, some data services provided by the target data service end corresponding to the second domain name may need to be shared in the page of the first domain name, for example, images, videos, or audios and the like provided by the target data service end corresponding to the second domain name are displayed in the page of the first domain name.
In this case, cross-domain access is involved, and thus, a page based on the first domain name needs to request, cross-domain, a target data server corresponding to the second domain name to provide data services, for example, a page based on the first domain name needs to request, cross-domain, a target data server to provide data services of a target category corresponding to a target service interface.
The target type data service is one type of user data service in a plurality of types of user data services provided by a target data service end corresponding to the second domain name, and the target service interface is a service interface developed by the target type data service. The target data service end corresponding to the second domain name has different service interfaces which are opened to the outside by a plurality of types of user data services provided by the outside. The first domain name and the second domain name may be different.
In a case that a target data server needs to request a target data server to provide a target type of data service corresponding to a target service interface based on a page of a first domain name in a cross-domain manner, a terminal may generate a cross-domain data request, where the cross-domain data request at least carries the target service interface and the first domain name, and then step S102 is performed.
In one example, the cross-domain data request may include a cross-domain http request or the like.
For example, an application (browser) in the terminal displays a page (home.111.com) of a data server corresponding to domain name www.111.com, and if an image www.222.com.jpg1 in the data server corresponding to domain name www.222.com needs to be introduced into the page (home.111.com) of the data server corresponding to domain name www.111.com, the page (home.111.com) causes the application (e.g., browser, etc.) in the terminal to initiate a cross-domain http request (request to acquire image www.222.com.jpg1) to the data server corresponding to domain name www.222.com.
The cross-domain request header may be included in a request header of a cross-domain data request generated by a terminal.
The cross-domain request header may include a request header in an access-control format. In the case that the data server normally responds to these cross-domain request headers, the data server will provide cross-domain data services.
In the present application, the request header in the access-control-format may include the following fields:
origin field: the Origin field may include a source domain name (e.g., the first domain name in this embodiment), i.e., may mark which domain name the cross-domain data request originated based on.
The gateway may determine whether the request header in the data request includes an Origin field in the case of receiving the data request sent by the terminal, and in the case that the Origin field is included, it indicates that the received data request is a cross-domain data request, step S102 may be executed, and in the case that the Origin field is not included, it indicates that the received data request is not a cross-domain data request, and may be a normal data request, and the data request may be processed according to a normal flow, which is not described in detail herein.
In step S102, it is determined whether the target data server allows the page cross-domain request based on the first domain name to provide the data service of the target type corresponding to the target service interface.
In an embodiment of the present application, the step may be implemented by the following process, including:
1021. acquiring a cross-domain name set which is read into a gateway in advance and is bound with at least a target service interface, wherein the cross-domain name set comprises: and supporting a cross-domain request target data service end to provide a source domain name based on a target type data service corresponding to a target service interface.
That is, at least which domain name is included in the cross-domain name set bound to the target service interface, the data service of the target type corresponding to the target service interface is provided by requesting the target data service end from the page based on which domain name in the cross-domain manner.
In this application, the gateway may extract the first domain name and the target service interface in the cross-domain data request, obtain a cross-domain name set that has been read in advance into the gateway and is bound to at least the target service interface, and then execute step 1022.
In one embodiment of the present application, any kind of data service that is open to the outside is used for the data service side.
If a function of supporting "cross-domain request for the data service end to provide the data service of the type based on a certain domain name (which may be different from the domain name of the data service end)" needs to be set in advance, a configuration instruction may be set in the gateway, where the configuration instruction carries a service interface which is open to the outside for the data service of the type and the domain name, and the setting request is used to set a function of supporting "cross-domain request for the data service end to provide the data service of the type based on the domain name (which may be different from the domain name of the data service end)"; then, the gateway may search a cross-domain name set corresponding to the service interface in a mapping relationship between a service interface open to the outside of the data service provided by the data service end and a cross-domain name set on which the data service end is allowed to request for providing the data service in a cross-domain manner, and then may add the domain name to the searched cross-domain name set.
If the cross-domain name set corresponding to the service interface is not found, a cross-domain name set including the domain name can be generated, and the service interface and the generated cross-domain name set form a corresponding table entry and are stored in the mapping relation.
The same is true for every other kind of data service for which the server side is open to the outside.
Referring to the above manner, if a function of "cross-domain request for the target data server to provide the target type of data service corresponding to the target service interface based on the first domain name (which may be different from the second domain name of the target data server)" needs to be configured in advance, a configuration instruction may be set in the gateway, where the configuration instruction carries the target service interface and the first domain name, and is used to configure a function of "cross-domain request for the target data server to provide the target type of data service corresponding to the target service interface based on the first domain name (which may be different from the second domain name of the target data server)"; then, the gateway can search a cross-domain name set corresponding to the target service interface in a mapping relation between a service interface which is open to the outside of the data service provided by the target data service end and the cross-domain name set on which the target data service end is allowed to request to provide the data service in a cross-domain manner, and then can add a first domain name in the searched cross-domain name set.
If the cross-domain name set corresponding to the target service interface is not found, a cross-domain name set including the first domain name can be generated, and the target service interface and the generated cross-domain name set form a corresponding table entry and are stored in the mapping relation.
Wherein, in a possible mode, when the configuration instruction is obtained, the method can support the staff to manually control the gateway to obtain the configuration instruction by means of interacting with the gateway, for example, the user may input a configuration operation for configuring the cross-domain name in the gateway (which may be a specific button that the user clicks to input), the gateway receives the configuration operation for configuring the cross-domain name input in the gateway, wherein, the gateway can know that the user needs to input the configuration instruction in the gateway under the condition of receiving the configuration operation of configuring the cross-domain name, in this way, the gateway may obtain, according to the configuration operation, a plurality of service interfaces (which may be all service interfaces or some common service interfaces) that are respectively open to the outside for each kind of data services provided by the target data service end to the outside, and obtain a plurality of candidate domain names. The candidate domain names include all domain names or partial domain names of manufacturers to which the target data server belongs.
Then, service interfaces and a plurality of candidate domain names which are respectively open to the outside for various types of data services provided by the target data service end to the outside can be displayed; and the user selects a target service interface from the displayed plurality of service interfaces and selects a first domain name from the displayed plurality of candidate domain names.
The method comprises the steps that a plurality of service interfaces and a plurality of candidate domain names are displayed on a page of the gateway, and a selection button can be displayed.
And under the condition that the gateway at least receives the selected operation aiming at a target service interface in the displayed multiple service interfaces and a first domain name in the displayed multiple candidate domain names, generating a configuration instruction according to the target service interface and the first domain name.
Thus, when the gateway acquires the cross-domain name set which is read into the gateway in advance and is bound with at least the target service interface, the gateway can search the cross-domain name set corresponding to the target service interface in the mapping relation between the service interface which is opened to the outside by the target data service end for providing the data service and the cross-domain name set based on which the target data service end is allowed to request to provide the data service in a cross-domain manner.
Further, according to actual requirements, it may be required to prohibit that the page based on the first domain name requests the target data server to provide the data service of the target class corresponding to the target service interface in a cross-domain manner, and in a case that it is required to prohibit that the page based on the first domain name requests the target data server to provide the data service of the target class corresponding to the target service interface in a cross-domain manner, a deletion instruction may be set in the gateway, where the deletion instruction carries the target service interface and the first domain name, and the deletion instruction is used to delete a function of "requesting the target data server to provide the data service of the target class corresponding to the target service interface in a cross-domain manner based on the first domain name (which may be different from a second domain name of the target data server)".
Then, the gateway can search a cross-domain name set corresponding to the target service interface in a mapping relation between a service interface which is open to the outside of the data service provided by the target data service end and the cross-domain name set on which the cross-domain request of the target data service end for providing the data service is allowed, and then can delete the first domain name in the searched cross-domain name set.
In a possible manner, when obtaining the deletion instruction, a worker may be supported to manually control the gateway to obtain the deletion instruction by interacting with the gateway, for example, a user may input a deletion operation for deleting the cross-domain name in the gateway (may be a specific button, and the user may input the deletion operation by clicking the button), and the gateway receives the deletion operation for deleting the cross-domain name input in the gateway, where the gateway may know that the user needs to input the deletion instruction in the gateway when receiving the deletion operation, and thus, the gateway may obtain a configured service interface that supports opening of a data service provided outside a target data service end in a cross-domain request according to the deletion operation.
And then displaying a service interface which supports cross-domain request of the target data service end to open a data service provided by the external service end, so that the user can select the target service interface from the displayed plurality of service interfaces.
Under the condition of receiving the selected operation of a target service interface in the displayed service interfaces, acquiring a set domain name based on which a target service terminal supporting cross-domain request to provide a target type of data service corresponding to the target service interface is requested; for example, in a mapping relationship between a service interface which is open to the outside of a data service provided by a target data service end and a cross-domain name set on which a cross-domain request is allowed to be made to the target data service end for providing the data service, a cross-domain name set corresponding to the target service interface is searched, and a domain name in the searched set is obtained.
And displaying the domain name based on which the target service supporting cross-domain request of the target service terminal provides the data service of the target type corresponding to the target service interface, so that the user can select the first domain name in the displayed domain names.
The method comprises the steps that a plurality of service interfaces and a plurality of domain names are displayed on a page of the gateway, a selection button can be displayed, after a worker inputs a clicking operation on a displayed first domain name, the clicking operation on the selection button can be input, and therefore the selecting operation of inputting the first domain name in the gateway is achieved.
And under the condition that the gateway receives the selected operation of the first domain name in the displayed plurality of domain names, generating a deleting instruction according to the target service interface and the first domain name.
1022. And under the condition that the first domain name is positioned in a cross-domain name set, allowing a page based on the first domain name to request a target data service terminal to provide data service of a target type corresponding to a target service interface in a cross-domain mode.
When the first domain name is located in the cross-domain name set, it indicates that a function of "requesting the target data server to provide the data service of the target type corresponding to the target service interface based on the first domain name (which may be different from the second domain name of the target data server) in a cross-domain manner" is configured in advance, and thus, the page based on the first domain name is allowed to request the target data server to provide the data service of the target type corresponding to the target service interface in a cross-domain manner.
1023. And under the condition that the first domain name is not located in the cross-domain name set, determining that the target data service end is not allowed to be requested to provide the data service of the target type corresponding to the target service interface based on the page cross-domain of the first domain name.
If the first domain name is not located in the cross-domain name set, it indicates that a function of "requesting the target data server to provide the data service of the target type corresponding to the target service interface based on the first domain name (which may be different from the second domain name of the target data server) in a cross-domain manner" is not configured in advance, and thus, the page based on the first domain name is not allowed to request the target data server to provide the data service of the target type corresponding to the target service interface in a cross-domain manner.
In step S103, in a case where the page cross-domain request based on the first domain name is allowed to provide the target data service of the target type corresponding to the target service interface, the cross-domain data request is forwarded to the target data service.
Therefore, the target data server can extract the target service interface in the cross-domain data request, and respond to the cross-domain data request according to the data processing logic of the target type data service corresponding to the target service interface.
For example, a data response is generated according to the data processing logic of the target type of data service corresponding to the target service interface and related information (for example, context information of the user, etc.) (the context information may include occupation, location, academic calendar, hobbies, and the like of the user), and then the data service may be provided to the user according to the context information of the user, for example, information that the user is interested in is obtained according to the context information of the user, and information that the user is interested in is recommended to the user, etc.), so that the data service corresponding to the target service interface is provided to the terminal across domains, further, the data response may be returned to the terminal, and the terminal receives the data response.
Or, in another embodiment, a static resource (such as a video, a picture, a voice, or a text) corresponding to the target service interface is acquired, and a data response is generated according to the acquired static resource, then the terminal returns the (cross-domain) data response, and the terminal receives the data response.
The response header of the data response generated by the target data server may include a cross-domain response header.
The cross-domain response header may include a response header in an access-control format.
In the present application, the response header in the access-control format may include the following fields:
Access-Control-all-Origin field: whether the domain name in the Origin field in a data request for responding to a cross-domain can be legally cross-domain.
Access-Control-Request-Method field: a method for indicating permitted use in a cross-domain data request.
Further, under the condition that the page cross-domain request based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface, the page cross-domain request based on the first domain name may not be forwarded to the target data service, and further, a failure response may be sent to the terminal, where the failure response is used to indicate that the page cross-domain request based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface. The terminal is informed that the page cross-domain request target data server based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface, so that the terminal can know that the page cross-domain request target data server based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface, the user is prevented from knowing why the data service of the target type cannot be provided by the target data server, and further the user experience is prevented from being reduced.
In the application, the data server may not perform the aforementioned action of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name", and the data server may allow the cross-domain data service to be provided according to the cross-domain data request as long as the data server receives the cross-domain data request forwarded by the gateway, so that the action of "generating a cross-domain data response according to the cross-domain data request, and returning the cross-domain data response to the terminal" may be directly performed, and the efficiency of the data server providing data service to the outside in a cross-domain manner may be improved.
In addition, since the data server may not perform the aforementioned action of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name", it is possible to determine whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name without configuring the function of "extracting the domain name in the Origin field in the cross-domain data request" in the data server. Secondly, the logic of the data server can be simplified, the management and maintenance cost of the data server in the later period can be reduced, and the occupation of system resources (such as storage resources, computing resources and the like) of the data server can be reduced, so that the data server can centralize more system resources in the aspects of obtaining input data (cross-domain data requests), then processing the input data to obtain output data (generating cross-domain data responses according to the cross-domain data requests), and outputting the output data (returning the cross-domain data responses to the terminal), the concurrency of the data server can be improved, and the efficiency of the data server for providing data services to the outside in a cross-domain mode can be further improved.
In some possible cases, before the terminal sends the cross-domain data request to the target data server via the gateway, the terminal may send a pre-request to the gateway for verifying the cross-domain policy of the target data server, for example, to verify whether to allow the page based on the first domain name to request the target data server to provide the data service of the target class corresponding to the target service interface in a cross-domain manner, and in a case that the page based on the first domain name is allowed to request the target data server to provide the data service of the target class corresponding to the target service interface in a cross-domain manner, the terminal further requests the target data server to provide the data service of the target class corresponding to the target service interface in a cross-domain manner based on the page of the first domain name.
For example, the terminal may send a pre-request to the gateway based on a page with a first domain name, the gateway receives the pre-request sent by the terminal based on the page with the first domain name, the pre-request carries at least a target service interface and the first domain name, and the pre-request is used to ask whether to allow the page with the first domain name to request the target data service terminal to provide a data service of a target type corresponding to the target service interface across domains.
Wherein the pre-request comprises preflash request and the like.
After receiving the request, the gateway may determine whether the type of the request is a cross-domain data request, a pre-request, or other.
And under the condition that the request is determined to be a pre-request, determining whether a page cross-domain request target data service terminal based on the first domain name is allowed to provide the data service of the target type corresponding to the target service interface or not according to the target service interface and the first domain name.
For example, referring to the content in step S102, a cross-domain name set that has been read into the gateway in advance and is bound to at least the target service interface is obtained, where the cross-domain name set includes: and supporting a cross-domain request target data service end to provide a source domain name based on a target type data service corresponding to a target service interface. And determining to allow a page cross-domain request target data service terminal based on the first domain name to provide a target type of data service corresponding to the target service interface under the condition that the first domain name is located in a cross-domain name set. And under the condition that the first domain name is not located in the cross-domain name set, determining that the target data service end is not allowed to be requested to provide the data service of the target type corresponding to the target service interface based on the page cross-domain of the first domain name.
And under the condition that the page cross-domain request based on the first domain name is allowed to provide the data service of the target type corresponding to the target service interface, generating an allowance response, and sending the allowance response to the terminal, wherein the allowance response is used for indicating that the page cross-domain request based on the first domain name is allowed to provide the data service of the target type corresponding to the target service interface.
In one example, the advance request may include an http request or the like, including, for example, an Option request or the like. The pre-request header may be included in the pre-request header.
The pre-request header may include a request header in access-control-format, including the following fields:
origin field: the Origin field may include a source domain name (e.g., the first domain name in this embodiment), i.e., may mark which domain name the cross-domain data request originated based on.
Access-Control-Request-Method field: a method for indicating a request for use in a cross-domain data request.
Access-Control-request-Header field: for indicating http header information used in the cross-domain data request.
Accordingly, the gateway may generate a pre-response (including an allow response, a deny response, etc.) corresponding to the pre-request.
The pre-response header may include the following fields:
Access-Control-Max-Age field: the buffering time for responding to the pre-response.
Access-Control-all-creatives field: for responding to subsequent cross-domain data requests to allow cookies to be sent.
Access-Control-all-Methods field: and the request method is used for responding to the subsequently sent cross-domain data request and allowing the use of the request method.
Access-Control-Allow-Headers field: and the HTTP header field is used for responding to the HTTP header field which is allowed to be used in the subsequently sent cross-domain data request.
Access-Control-all-Origin field: whether the domain name in the Origin field in the data request for responding to the cross-domain can be legally cross-domain.
Thus, for the gateway, after receiving the Request, it can check which resources are included in the Request Header of the Request, if only the Origin field is included, it can be determined that the Request is a cross-domain data Request, and if the Origin field, the Access-Control-Request-Method field, and the Access-Control-Request-Header field are included, it is determined that the Request is a pre-Request.
Accordingly, the cross-domain data request sent by the receiving terminal based on the page of the first domain name may be a cross-domain data request sent by the receiving terminal according to the permission response and the page of the first domain name.
In another embodiment of the application, in a case that the page cross-domain request based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface, a rejection response is generated and sent to the terminal, where the rejection response is used to indicate that the page cross-domain request based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface. The method comprises the steps of informing a terminal of indicating that a page cross-domain request target data service terminal based on a first domain name is not allowed to provide a data service of a target type corresponding to a target service interface, so that the terminal can know that the page cross-domain request target data service terminal based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface, and then a user can know that the page cross-domain request target data service terminal based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface, so as to feed back the user, and further avoid reducing user experience.
In this application, in some cases, the terminal may directly send a cross-domain data request to the target data server via the gateway, and in other cases, the terminal needs to send a pre-request to the gateway first, and after obtaining an allowance response returned by the gateway and used for indicating that the target data server is allowed to provide the data service of the target type corresponding to the target service interface based on the page request of the first domain name, the terminal directly sends the cross-domain data request to the target data server via the gateway.
In the case that GET, HEAD, or POST is recorded in the Method field in the request header of the request, and application/x-www-form-url, multipart/form-data, or text/plane is recorded in the Content-Type field in the request header, and the customized request header in the request belongs to the set of security headers, the terminal can directly send the cross-domain data request to the target data server via the gateway. Otherwise, the terminal needs to send a pre-request to the gateway, and after obtaining an allowance response returned by the gateway and used for indicating that the page request target data server based on the first domain name is allowed to provide the data service of the target type corresponding to the target service interface, the terminal directly sends a cross-domain data request to the target data server through the gateway.
The set of security heads includes: accept, Accept-Languge, Content-Type, DPR, Downlink, Save-Data, Viewport-Width, and the like.
Specifically, referring to fig. 3, a flowchart of a data processing method based on a data processing system according to the present application is shown, where the method is applied to a target data server in at least one data server shown in fig. 1, and the method includes:
in step S201, a cross-domain data request sent by the gateway is received;
the cross-domain data request at least carries a target service interface and a first domain name, and the target service interface comprises: a service interface which is opened to the outside by a target data service end in at least one data service end and provides a target type of data service to the outside; the cross-domain data request is used for requesting a target data server to provide a target type data service corresponding to a target service interface based on a page of a first domain name in a cross-domain manner; the cross-domain data request is sent to the gateway by the terminal based on the page of the first domain name, and is sent to the target data server by the gateway under the condition that the gateway determines that the target data server allows the page based on the first domain name to request the target data server to provide the target type of data service corresponding to the target service interface in a cross-domain mode according to the target service interface and the first domain name;
in step S202, extracting a target service interface in the cross-domain data request;
in step S203, a data response is generated according to the data processing logic of the data service corresponding to the target service interface.
In the application, the data server may not perform the aforementioned action of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name", and the data server may allow the cross-domain data service to be provided according to the cross-domain data request as long as the data server receives the cross-domain data request forwarded by the gateway, so that the action of "generating a cross-domain data response according to the cross-domain data request, and returning the cross-domain data response to the terminal" may be directly performed, and the efficiency of the data server providing data service to the outside in a cross-domain manner may be improved.
In addition, since the data server may not perform the aforementioned action of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name", it is possible to determine whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name without configuring the function of "extracting the domain name in the Origin field in the cross-domain data request" in the data server. Secondly, the logic of the data server can be simplified, the management and maintenance cost of the data server in the later period can be reduced, and the occupation of system resources (such as storage resources, computing resources and the like) of the data server can be reduced, so that the data server can centralize more system resources in the aspects of obtaining input data (cross-domain data requests), then processing the input data to obtain output data (generating cross-domain data responses according to the cross-domain data requests), and outputting the output data (returning the cross-domain data responses to the terminal), the concurrency of the data server can be improved, and the efficiency of the data server for providing data services to the outside in a cross-domain mode can be further improved.
It is noted that, for simplicity of explanation, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will appreciate that the present application is not limited by the order of acts, as some steps may, in accordance with the present application, occur in other orders and concurrently. Further, those skilled in the art will also appreciate that the embodiments described in the specification are exemplary and that no action is necessarily required in this application.
Referring to fig. 4, there is shown a block diagram of a data processing apparatus of the present application based on a data processing system, the system comprising: the gateway and at least one data server, the communication connection between gateway and each data server, the device is applied to the gateway, the device includes:
a first receiving module 11, configured to receive a cross-domain data request sent by a terminal based on a page of a first domain name, where the cross-domain data request at least carries a target service interface and the first domain name, and the target service interface includes: a target data service end in at least one data service end is a service interface which is open to the outside for the data service of a target type provided by the outside; the cross-domain data request is used for requesting a target data server to provide a target type data service corresponding to a target service interface based on a page cross-domain of a first domain name;
the first determining module 12 is configured to determine, according to the target service interface and the first domain name, whether the target data service end allows a page based on the first domain name to request the target data service end to provide a data service of a target type corresponding to the target service interface in a cross-domain manner;
the forwarding module 13 is configured to forward a cross-domain data request to a target data server when a page based on a first domain name is allowed to request the target data server to provide a target type of data service corresponding to a target service interface in a cross-domain manner.
In an optional implementation manner, the apparatus further includes:
the first sending module is used for sending a failure response to the terminal under the condition that the page cross-domain request target data server based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface, wherein the failure response is used for indicating that the page cross-domain request target data server based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface.
In an optional implementation manner, the first determining module includes:
an obtaining unit, configured to obtain a cross-domain name set that is read into a gateway in advance and is bound to at least a target service interface, where the cross-domain name set includes: supporting a cross-domain request target data server to provide a source domain name based on a target type of data service corresponding to a target service interface;
the first determining unit is used for allowing a determining end to request a target data service end to provide data services of a target type corresponding to a target service interface in a cross-domain mode based on a page of a first domain name under the condition that the first domain name is located in a cross-domain name set;
alternatively, the first and second electrodes may be,
and the second determining unit is used for determining that the target data service end is not allowed to request the target data service end to provide the data service of the target type corresponding to the target service interface in a cross-domain mode based on the page of the first domain name under the condition that the first domain name is not located in the cross-domain name set.
In an optional implementation manner, the obtaining unit includes:
the searching subunit is configured to search a cross-domain name set corresponding to the target data service interface in a mapping relationship between a service interface, which is open to the outside, of the data service provided by the target data service end and a cross-domain name set, on which the target data service end is allowed to request for providing the data service in a cross-domain manner.
In an optional implementation manner, the obtaining unit further includes:
the first obtaining subunit is configured to obtain a configuration instruction, where the configuration instruction carries a target service interface and a first domain name, and the configuration instruction is used to configure a function of requesting, based on the first domain name, a target data server to provide a target type of data service corresponding to the target service interface in a cross-domain manner;
the adding subunit is used for searching a cross-domain name set corresponding to the target service interface in the mapping relation; adding a first domain name in the searched cross-domain name set;
or, the storage subunit is configured to generate a cross-domain name set including the first domain name if the cross-domain name set corresponding to the target service interface is not found, and combine the target service interface and the generated cross-domain name set into a corresponding entry and store the entry in the mapping relationship.
In an optional implementation manner, the first obtaining subunit is specifically configured to:
receiving configuration operation of configuring cross-domain names input in a gateway;
according to configuration operation, a plurality of service interfaces which are respectively opened to the outside by a target data service end for various types of data services provided by the target data service end are obtained, and a plurality of candidate domain names are obtained;
displaying service interfaces and a plurality of candidate domain names which are respectively opened to the outside by the target data service end for various types of data services provided by the outside;
and generating a configuration instruction according to the target service interface and the first domain name under the condition of at least receiving the selected operation aiming at the target service interface in the displayed plurality of service interfaces and the first domain name in the displayed plurality of candidate domain names.
In an optional implementation manner, the obtaining unit further includes:
the second obtaining subunit is configured to obtain a deletion instruction, where the deletion instruction carries the target service interface and the first domain name, and the deletion instruction is used to delete a function of requesting, based on the first domain name, the target data service end to provide a data service of a target type corresponding to the target service interface in a cross-domain manner;
the searching subunit is used for searching a cross-domain name set corresponding to the target service interface in the mapping relation;
and the deleting subunit is used for deleting the first domain name from the searched cross-domain name set.
In an optional implementation manner, the second obtaining subunit is specifically configured to:
receiving a deletion operation of deleting a cross-domain name input in a gateway;
acquiring a configured service interface which supports the opening of a data service provided by a cross-domain request target data service end to the outside according to the deleting operation;
displaying a service interface which supports the cross-domain request of the data service end provided by the target data service end to the outside and is open to the outside;
under the condition of receiving the selected operation of a target service interface in the displayed service interfaces, acquiring a set domain name based on which a target service terminal supporting cross-domain request to provide a target type of data service corresponding to the target service interface is requested;
displaying a domain name based on which a target service supporting cross-domain request of a target service end provides a target type of data service corresponding to a target service interface;
and under the condition that the gateway receives the selected operation of the first domain name in the displayed plurality of domain names, generating a deleting instruction according to the target service interface and the first domain name.
In an optional implementation, the apparatus further comprises:
the second receiving module is used for receiving a pre-request sent by the terminal based on the page of the first domain name, the pre-request at least carries a target service interface and the first domain name, and the pre-request is used for asking whether the page based on the first domain name is allowed to request a target data service terminal to provide data service of a target type corresponding to the target service interface in a cross-domain mode;
the second determining module is used for determining whether a page cross-domain request target data server based on the first domain name is allowed to provide data services of a target type corresponding to the target service interface according to the target service interface and the first domain name;
the second sending module is used for generating a permission response and sending the permission response to the terminal under the condition that the page based on the first domain name is allowed to request the target data server to provide the data service of the target type corresponding to the target service interface in a cross-domain manner, wherein the permission response is used for indicating that the page based on the first domain name is allowed to request the target data server to provide the data service of the target type corresponding to the target service interface in a cross-domain manner;
accordingly, the second receiving module comprises:
and the receiving unit is used for receiving the cross-domain data request sent by the terminal according to the permission response and the page of the first domain name.
In an optional implementation, the apparatus further comprises:
and the third sending module is used for generating a rejection response and sending the rejection response to the terminal under the condition that the page cross-domain request based on the first domain name is not allowed to the target data service terminal to provide the data service of the target type corresponding to the target service interface, wherein the rejection response is used for indicating that the page cross-domain request based on the first domain name is not allowed to the target data service terminal to provide the data service of the target type corresponding to the target service interface.
In the application, the data server may not perform the aforementioned action of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name", where the data server is allowed to provide the cross-domain data service according to the cross-domain data request as long as the data server receives the cross-domain data request forwarded by the gateway, so that an action of "generating a cross-domain data response according to the cross-domain data request, and returning the cross-domain data response to the terminal" may be directly performed, and the efficiency of providing the data service to the outside in the cross-domain manner by the data server may be improved.
In addition, since the data server may not perform the aforementioned action of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name", it is possible to determine whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name without configuring the function of "extracting the domain name in the Origin field in the cross-domain data request" in the data server. Secondly, the logic of the data server can be simplified, the management and maintenance cost of the data server in the later period can be reduced, and the occupation of system resources (such as storage resources, computing resources and the like) of the data server can be reduced, so that the data server can centralize more system resources in the aspects of obtaining input data (cross-domain data requests), then processing the input data to obtain output data (generating cross-domain data responses according to the cross-domain data requests), and outputting the output data (returning the cross-domain data responses to the terminal), the concurrency of the data server can be improved, and the efficiency of the data server for providing data services to the outside in a cross-domain mode can be further improved.
Referring to fig. 5, there is shown a block diagram of a data processing apparatus of the present application based on a data processing system, the system comprising: the gateway and at least one data server, the gateway and each data server communication connection, the device is applied to at least one data server in the target data server, the device includes:
a third receiving module 21, configured to receive a cross-domain data request sent by the gateway;
the cross-domain data request at least carries a target service interface and a first domain name, and the target service interface comprises: a service interface which is opened to the outside by a target data service end in at least one data service end and provides a target type of data service to the outside; the cross-domain data request is used for requesting a target data server to provide a target type data service corresponding to a target service interface based on a page cross-domain of a first domain name; the cross-domain data request is sent to the gateway by the terminal based on the page of the first domain name, and is sent to the target data server by the gateway under the condition that the gateway determines that the target data server allows the page based on the first domain name to request the target data server to provide the target type of data service corresponding to the target service interface in a cross-domain mode according to the target service interface and the first domain name;
an extracting module 22, configured to extract a target service interface in a cross-domain data request;
and the generating module 23 is configured to generate a data response according to the data processing logic of the data service corresponding to the target service interface.
In the application, the data server may not perform the aforementioned action of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name", where the data server is allowed to provide the cross-domain data service according to the cross-domain data request as long as the data server receives the cross-domain data request forwarded by the gateway, so that an action of "generating a cross-domain data response according to the cross-domain data request, and returning the cross-domain data response to the terminal" may be directly performed, and the efficiency of providing the data service to the outside in the cross-domain manner by the data server may be improved.
In addition, since the data server may not perform the aforementioned action of "extracting the domain name in the Origin field in the cross-domain data request, and determine whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name", a function of "extracting the domain name in the Origin field in the cross-domain data request, and determining whether to allow the data server corresponding to another domain name to provide data service in a cross-domain manner on the page of the domain name" may not be configured in the data server. Secondly, the logic of the data server can be simplified, the management and maintenance cost of the data server in the later period can be reduced, and the occupation of system resources (such as storage resources and computing resources and the like) of the data server can be reduced, so that the data server can centralize more system resources in the aspects of obtaining input data (cross-domain data requests), then processing the input data to obtain output data (generating cross-domain data responses according to the cross-domain data requests), and outputting the output data (returning the cross-domain data responses to the terminal), the concurrency of the data server can be improved, and the efficiency of the data server for providing data services to the outside in a cross-domain manner is further improved.
The embodiments of the present application also provide a non-volatile readable storage medium, where one or more modules (programs) are stored in the storage medium, and when the one or more modules are applied to a device, the one or more modules may cause the device to execute instructions (instructions) of method steps in the embodiments of the present application.
Embodiments of the present application provide one or more machine-readable media having instructions stored thereon, which when executed by one or more processors, cause an electronic device to perform the methods as described in one or more of the above embodiments. In the embodiment of the application, the electronic device comprises a server, a gateway, a sub-device and the like, wherein the sub-device is a device such as an internet of things device.
Embodiments of the present disclosure may be implemented as an apparatus, which may include electronic devices such as servers (clusters), terminal devices such as IoT devices, and the like, using any suitable hardware, firmware, software, or any combination thereof, for a desired configuration.
Fig. 6 schematically illustrates an example apparatus 1300 that can be used to implement various embodiments described herein.
For one embodiment, fig. 6 illustrates an example apparatus 1300 having one or more processors 1302, a control module (chipset) 1304 coupled to at least one of the processor(s) 1302, memory 1306 coupled to the control module 1304, non-volatile memory (NVM)/storage 1308 coupled to the control module 1304, one or more input/output devices 1310 coupled to the control module 1304, and a network interface 1312 coupled to the control module 1304.
Processor 1302 may include one or more single-core or multi-core processors, and processor 1302 may include any combination of general-purpose or special-purpose processors (e.g., graphics processors, application processors, baseband processors, etc.). In some embodiments, the apparatus 1300 can be a server device such as a gateway described in the embodiments of the present application.
In some embodiments, apparatus 1300 may include one or more computer-readable media (e.g., memory 1306 or NVM/storage 1308) having instructions 1314 and one or more processors 1302, which in combination with the one or more computer-readable media, are configured to execute instructions 1314 to implement modules to perform actions described in this disclosure.
For one embodiment, the control module 1304 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 1302 and/or any suitable device or component in communication with the control module 1304.
The control module 1304 may include a memory controller module to provide an interface to the memory 1306. The memory controller module may be a hardware module, a software module, and/or a firmware module.
Memory 1306 may be used, for example, to load and store data and/or instructions 1314 for device 1300. For one embodiment, memory 1306 may comprise any suitable volatile memory, such as suitable DRAM. In some embodiments, the memory 1306 may comprise double data rate four synchronous dynamic random access memory (DDR4 SDRAM).
For one embodiment, control module 1304 may include one or more input/output controllers to provide an interface to NVM/storage 1308 and input/output device(s) 1310.
For example, NVM/storage 1308 may be used to store data and/or instructions 1314. NVM/storage 1308 may include any suitable non-volatile memory (e.g., flash memory) and/or may include any suitable non-volatile storage device(s) (e.g., one or more Hard Disk Drives (HDDs), one or more Compact Disc (CD) drives, and/or one or more Digital Versatile Disc (DVD) drives).
The NVM/storage 1308 may include storage resources that are physically part of the device on which the apparatus 1300 is installed, or it may be accessible by the device and may not be necessary as part of the device. For example, NVM/storage 1308 may be accessible over a network via input/output device(s) 1310.
Input/output device(s) 1310 may provide an interface for apparatus 1300 to communicate with any other suitable device, input/output device(s) 1310 may include a communications component, a pinyin component, a sensor component, and so forth. The network interface 1312 may provide an interface for the device 1300 to communicate over one or more networks, and the device 1300 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and/or protocols, such as access to a communication standard-based wireless network, e.g., WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof.
For one embodiment, at least one of the processor(s) 1302 may be packaged together with logic for one or more controllers (e.g., memory controller modules) of the control module 1304. For one embodiment, at least one of the processor(s) 1302 may be packaged together with logic for one or more controllers of the control module 1304 to form a System In Package (SiP). For one embodiment, at least one of the processor(s) 1302 may be integrated on the same die with logic for one or more controller(s) of the control module 1304. For one embodiment, at least one of the processor(s) 1302 may be integrated on the same die with logic of one or more controllers of the control module 1304 to form a system on chip (SoC).
In various embodiments, apparatus 1300 may be, but is not limited to being: a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet, a netbook, etc.), among other terminal devices. In various embodiments, apparatus 1300 may have more or fewer components and/or different architectures. For example, in some embodiments, device 1300 includes one or more cameras, a keyboard, a Liquid Crystal Display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an Application Specific Integrated Circuit (ASIC), and speakers.
An embodiment of the present application provides an electronic device, including: one or more processors; and one or more machine readable media having instructions stored thereon that, when executed by the one or more processors, cause the electronic device to perform a method as described in one or more of the present applications.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable information processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable information processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable information processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable information processing terminal device to cause a series of operational steps to be performed on the computer or other programmable terminal device to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal device provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present application have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all changes and modifications that fall within the true scope of the embodiments of the present application.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The data processing method and apparatus based on the data processing system provided by the present application are introduced in detail, and a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the above embodiment is only used to help understand the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (13)

1. A data processing method based on a data processing system, the system comprising: the method is applied to the gateway and comprises the following steps:
receiving a cross-domain data request sent by a terminal based on a page of a first domain name, wherein the cross-domain data request at least carries a target service interface and the first domain name, and the target service interface comprises: a service interface which is opened to the outside by a target data service end in at least one data service end and provides a target type of data service to the outside; the cross-domain data request is used for requesting a target data server to provide a target type data service corresponding to a target service interface based on a page cross-domain of a first domain name;
determining whether a target data server allows a page cross-domain request based on a first domain name to provide a target type data service corresponding to a target service interface or not according to the target service interface and the first domain name;
and under the condition that a page cross-domain request target data server based on the first domain name is allowed to provide a target type data service corresponding to the target service interface, forwarding the cross-domain data request to the target data server.
2. The method of claim 1, further comprising:
and under the condition that the page cross-domain request based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface, sending a failure response to the terminal, wherein the failure response is used for indicating that the page cross-domain request based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface.
3. The method according to claim 1, wherein the determining, according to the target service interface and the first domain name, whether the target data server allows a page based on the first domain name to request the target data server to provide a data service of a target category corresponding to the target service interface across domains includes:
acquiring a cross-domain name set which is read into a gateway in advance and is bound with at least a target service interface, wherein the cross-domain name set comprises: supporting a cross-domain request target data server to provide a source domain name based on a target type of data service corresponding to a target service interface;
under the condition that the first domain name is located in a cross-domain name set, allowing a page based on the first domain name to request a target data service terminal to provide data service of a target type corresponding to a target service interface in a cross-domain manner by a determining terminal;
alternatively, the first and second liquid crystal display panels may be,
and under the condition that the first domain name is not located in the cross-domain name set, determining that the target data service end is not allowed to be requested to provide the data service of the target type corresponding to the target service interface based on the page cross-domain of the first domain name.
4. The method of claim 1, wherein obtaining a set of cross-domain names that have been read into a gateway in advance and bound to at least a target service interface comprises:
and searching a cross-domain name set corresponding to the target service interface in a mapping relation between a service interface which is open to the outside of the data service provided by the target data service end and the cross-domain name set based on which the target data service end is allowed to request to provide the data service in a cross-domain manner.
5. The method of claim 4, further comprising:
acquiring a configuration instruction, wherein the configuration instruction carries a target service interface and a first domain name, and is used for configuring a function of requesting a target data service terminal to provide a target type of data service corresponding to the target service interface based on the first domain name in a cross-domain manner;
searching a cross-domain name set corresponding to a target service interface in the mapping relation; adding a first domain name in the searched cross-domain name set;
or if the cross-domain name set corresponding to the target service interface is not found, generating a cross-domain name set comprising the first domain name, and forming a corresponding table entry by the target service interface and the generated cross-domain name set and storing the corresponding table entry in the mapping relation.
6. The method of claim 5, wherein obtaining the configuration instruction comprises:
receiving configuration operation of configuring cross-domain names input in a gateway;
according to configuration operation, a plurality of service interfaces which are respectively opened to the outside by a target data service end for various types of data services provided by the target data service end are obtained, and a plurality of candidate domain names are obtained;
displaying service interfaces and a plurality of candidate domain names which are respectively opened to the outside by the target data service end for various types of data services provided by the outside;
and generating a configuration instruction according to the target service interface and the first domain name under the condition of at least receiving the selected operation aiming at the target service interface in the displayed plurality of service interfaces and the first domain name in the displayed plurality of candidate domain names.
7. The method of claim 4, further comprising:
acquiring a deleting instruction, wherein the deleting instruction carries a target service interface and a first domain name, and the deleting instruction is used for deleting a function of requesting a target data service terminal to provide a target type of data service corresponding to the target service interface based on the first domain name in a cross-domain manner;
searching a cross-domain name set corresponding to a target service interface in the mapping relation;
and deleting the first domain name from the searched cross-domain name set.
8. The method of claim 7, wherein the obtaining the delete instruction comprises:
receiving a deletion operation of deleting a cross-domain name input in a gateway;
acquiring a configured service interface which supports the opening of a data service provided by a cross-domain request target data service end to the outside according to the deleting operation;
displaying a service interface which supports the cross-domain request of the data service end provided by the target data service end to the outside and is open to the outside;
under the condition of receiving the selected operation of a target service interface in the displayed service interfaces, acquiring a set domain name based on which a target service terminal supporting cross-domain request to provide a target type of data service corresponding to the target service interface is requested;
displaying a domain name based on which a target service supporting cross-domain request of a target service end provides a target type of data service corresponding to a target service interface;
and under the condition that the gateway receives the selected operation of the first domain name in the displayed plurality of domain names, generating a deleting instruction according to the target service interface and the first domain name.
9. The method of claim 1, further comprising:
the method comprises the steps that a pre-request sent by a terminal based on a page of a first domain name is received, the pre-request at least carries a target service interface and the first domain name, and the pre-request is used for asking whether a page based on the first domain name is allowed to request a target data service terminal to provide data services of a target type corresponding to the target service interface in a cross-domain mode;
determining whether a page cross-domain request target data server based on a first domain name is allowed to provide a target type data service corresponding to a target service interface or not according to the target service interface and the first domain name;
generating an allowance response under the condition that the page based on the first domain name is allowed to request the target data server to provide the data service of the target type corresponding to the target service interface in a cross-domain manner, and sending the allowance response to the terminal, wherein the allowance response is used for indicating that the page based on the first domain name is allowed to request the target data server to provide the data service of the target type corresponding to the target service interface in the cross-domain manner;
correspondingly, the receiving terminal sends the cross-domain data request based on the page of the first domain name, and the cross-domain data request comprises:
and receiving a cross-domain data request sent by the terminal according to the permission response and the page of the first domain name.
10. The method of claim 9, further comprising:
and under the condition that the page cross-domain request target data service terminal based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface, generating a rejection response, and sending the rejection response to the terminal, wherein the rejection response is used for indicating that the page cross-domain request target data service terminal based on the first domain name is not allowed to provide the data service of the target type corresponding to the target service interface.
11. A data processing method based on a data processing system, the system comprising: the method is applied to a target data server in the at least one data server, and comprises the following steps:
receiving a cross-domain data request sent by the gateway;
the cross-domain data request at least carries a target service interface and a first domain name, and the target service interface comprises: a service interface which is opened to the outside by a target data service end in at least one data service end and provides a target type of data service to the outside; the cross-domain data request is used for requesting a target data server to provide a target type data service corresponding to a target service interface based on a page cross-domain of a first domain name; the cross-domain data request is sent to the gateway by the terminal based on the page of the first domain name, and is sent to the target data server by the gateway under the condition that the gateway determines that the target data server allows the page based on the first domain name to request the target data server to provide the target type of data service corresponding to the target service interface in a cross-domain mode according to the target service interface and the first domain name;
extracting a target service interface in the cross-domain data request;
and generating a data response according to the data processing logic of the data service corresponding to the target service interface.
12. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method according to any of claims 1 to 11 are implemented when the processor executes the program.
13. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 11.
CN202210275874.2A 2022-03-18 2022-03-18 Data processing method and device based on data processing system Active CN114640718B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210275874.2A CN114640718B (en) 2022-03-18 2022-03-18 Data processing method and device based on data processing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210275874.2A CN114640718B (en) 2022-03-18 2022-03-18 Data processing method and device based on data processing system

Publications (2)

Publication Number Publication Date
CN114640718A true CN114640718A (en) 2022-06-17
CN114640718B CN114640718B (en) 2023-06-23

Family

ID=81950398

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210275874.2A Active CN114640718B (en) 2022-03-18 2022-03-18 Data processing method and device based on data processing system

Country Status (1)

Country Link
CN (1) CN114640718B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105871947A (en) * 2015-01-20 2016-08-17 阿里巴巴集团控股有限公司 Method and device for cross-domain data request
CN108256069A (en) * 2018-01-17 2018-07-06 阿里巴巴集团控股有限公司 A kind of method and apparatus of the cross-domain access of the page
CN109688280A (en) * 2018-08-21 2019-04-26 平安科技(深圳)有限公司 Request processing method, request processing equipment, browser and storage medium
CN112243013A (en) * 2019-07-16 2021-01-19 中国移动通信集团浙江有限公司 Method, system, server and storage medium for realizing cross-domain resource caching
WO2021218018A1 (en) * 2020-04-28 2021-11-04 平安科技(深圳)有限公司 Data processing method and apparatus for implementing cross-domain request at webpage end, and related device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105871947A (en) * 2015-01-20 2016-08-17 阿里巴巴集团控股有限公司 Method and device for cross-domain data request
CN108256069A (en) * 2018-01-17 2018-07-06 阿里巴巴集团控股有限公司 A kind of method and apparatus of the cross-domain access of the page
CN109688280A (en) * 2018-08-21 2019-04-26 平安科技(深圳)有限公司 Request processing method, request processing equipment, browser and storage medium
CN112243013A (en) * 2019-07-16 2021-01-19 中国移动通信集团浙江有限公司 Method, system, server and storage medium for realizing cross-domain resource caching
WO2021218018A1 (en) * 2020-04-28 2021-11-04 平安科技(深圳)有限公司 Data processing method and apparatus for implementing cross-domain request at webpage end, and related device

Also Published As

Publication number Publication date
CN114640718B (en) 2023-06-23

Similar Documents

Publication Publication Date Title
RU2586878C2 (en) System and method for remote control of web browser
EP3428809B1 (en) Service execution method and device
US9047393B1 (en) Cross-domain communications with a shared worker application
US8886819B1 (en) Cross-domain communication in domain-restricted communication environments
US11314473B2 (en) Method and apparatus for displaying digital object identifier
US20150365497A1 (en) Providing access to information across multiple computing devices
US9137094B1 (en) Method for setting DNS records
WO2015154666A1 (en) Method for displaying webpage fragment on desktop and system for capturing webpage fragment to desktop for display
US11032683B2 (en) Method and apparatus for publishing cloud resource
CN104756080A (en) Augmenting capabilities of a host device
US20130286416A1 (en) System and Method of Installing Printer Applications on a Printer
US20140337536A1 (en) Method and apparatus for data communication
US9706006B2 (en) System and method of context aware adaption of content for a mobile device
US20140325089A1 (en) Method, terminal, server and system for page jump
US20140157104A1 (en) Dynamic sharing and updating of a web page
CN116304403A (en) Webpage access method and device, computer equipment and storage medium
CN114640718B (en) Data processing method and device based on data processing system
US20140344756A1 (en) Information processing apparatus, and control method therefor
US10965781B2 (en) Method and server for displaying access content
CN107592373B (en) Information request method and device for multi-domain name page and user terminal
US20190325073A1 (en) Systems and Methods for Providing Content Items in Situations Involving Suboptimal Network Conditions
US20150172360A1 (en) Cross-device operation using gestures
CN109426530B (en) Page determination method, device, server and storage medium
CN115720224A (en) Desktop cloud based access method and device, electronic equipment and medium
CN114218330A (en) ES cluster selection method, ES cluster selection device, ES cluster selection apparatus, ES cluster selection medium, and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant