Single-page application port adaptive navigation method, device and equipment and storage medium

By combining URL interception processors and port policy tables, the target port is dynamically calculated and the navigation request is rewritten, solving the adaptation problem of navigation requests in single-page applications. This achieves efficient and secure port-adaptive navigation, improving the reliability and ease of operation and maintenance of enterprise mobile applications.

CN122160368APending Publication Date: 2026-06-05SHENZHEN LEAGSOFT TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN LEAGSOFT TECH
Filing Date
2026-01-23
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing enterprise mobile applications cannot adapt to dynamic changes in backend ports when handling single-page application navigation requests, resulting in navigation request failures. Furthermore, the lack of a unified port management mechanism increases the difficulty of operation and maintenance and security risks.

Method used

Navigation requests are intercepted by a pre-registered URL interceptor. The target port is calculated based on a pre-set port policy table and the current operating environment status. The port in the navigation request is then rewritten as the target port to achieve adaptive navigation.

Benefits of technology

It improves the response efficiency of navigation requests, avoids the risk of security policy bypass, provides a unified port management mechanism, reduces the difficulty of operation and maintenance, and ensures business continuity and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122160368A_ABST
    Figure CN122160368A_ABST
Patent Text Reader

Abstract

The application relates to a single-page application port adaptive navigation method and device, equipment and a storage medium. When a navigation request for the single-page application is initiated, the navigation request is intercepted by a pre-registered URL interception processor; a target port is calculated based on a preset port strategy table and a current running environment state; the port in the navigation request is rewritten as the target port to obtain a rewritten address; and a corresponding single-page application page is loaded based on the rewritten address. Compared with the prior art, the technical scheme of the application dynamically calculates a target port and rewrites the port of a navigation request, realizes adaptive adaptation of the port, avoids the disadvantages of backend redirection, provides support for unified port management and fault tracing, and improves the reliability and operation convenience of single-page application navigation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of enterprise mobile application front-end navigation and secure access control, and in particular to a single-page application port adaptive navigation method, apparatus, device and storage medium. Background Technology

[0002] In enterprise digital office scenarios, mobile applications have become the core support for business operations. To achieve modular functionality and flexible deployment, enterprise mobile applications typically embed multiple single-page applications and meet different business needs through multiple entry points. The backend service ports of these applications are not fixed values ​​and will dynamically change depending on the network environment accessed by the user, tunnel connection status, and other scenarios, resulting in port-differentiated configuration requirements in multiple environments.

[0003] When handling single-page application navigation requests, existing enterprise mobile applications generally adopt either client-side hard-coded ports or reliance on backend redirection. Hard-coded ports cannot adapt to dynamic changes in backend ports, and when the network environment or tunnel status changes, single-page application navigation requests are prone to failure, directly affecting business continuity. On the other hand, relying on backend redirection not only has low response efficiency, but may also pose a risk of security policy bypass, rendering the enterprise's preset access control rules ineffective and failing to guarantee access security.

[0004] Meanwhile, existing technologies lack a unified port management mechanism for multiple single-page application entry points. The port configurations of different entry points are scattered and independent, making it difficult to meet the differentiated port configuration requirements of enterprises for multi-tenant and multi-business scenarios, and increasing the difficulty of application operation and maintenance and configuration management. In addition, the lack of a unified process control foundation for multiple entry point access makes it impossible to quickly trace the port configuration and request processing process when navigation fails, resulting in low efficiency in problem localization and debugging, and further reducing the overall reliability and ease of operation and maintenance of the application. Summary of the Invention

[0005] This application provides a method, apparatus, device, and storage medium for adaptive port navigation in single-page applications. By dynamically calculating the target port and rewriting the navigation request port, adaptive port adaptation is achieved, avoiding the drawbacks of backend redirection. At the same time, it provides support for unified port management and fault tracing, improving the reliability and ease of operation and maintenance of single-page application navigation.

[0006] In a first aspect, this application provides a single-page application port adaptive navigation method, comprising: when a navigation request for the single-page application is initiated, intercepting the navigation request through a pre-registered URL interception processor; calculating a target port based on a preset port policy table and the current running environment state; rewriting the port in the navigation request to the target port to obtain a rewritten address; and loading the corresponding single-page application page based on the rewritten address.

[0007] In one possible implementation, after the URL interception processor intercepts the navigation request, it further includes: determining whether the target address in the navigation request belongs to a preset list of addresses to be processed; if so, calculating the target port based on a preset port policy table and the current running environment status; otherwise, directly loading the corresponding single-page application page based on the original address in the navigation request.

[0008] In one possible implementation, determining whether the target address in the navigation request belongs to a preset list of addresses to be processed specifically includes: determining whether the current situation is a preset business scenario that requires triggering port adaptive processing; if it is in the business scenario, extracting the target path from the target URL in the navigation request and matching the target path with the business interface address in the list of addresses to be processed; if the match is successful, determining that the target address in the navigation request belongs to the preset list of addresses to be processed.

[0009] In one possible implementation, calculating the target port based on a preset port policy table and the current operating environment status specifically includes: obtaining the current operating environment status, wherein the current operating environment status includes at least the tunnel connection status; matching the corresponding port policy entry from the preset port policy table according to the domain name information in the navigation request; and determining the target port from the port configuration field of the port policy entry according to the tunnel connection status; wherein the port policy table includes at least a domain name, a primary domain identifier, and port configuration fields corresponding to different service types, and the port configuration fields include at least a tunnel port for dedicated tunnel access and a single-page application port for single-page application access.

[0010] In one possible implementation, the port policy table further includes a tenant identifier. The step of matching the corresponding port policy entry from the preset port policy table based on the domain name information in the navigation request specifically includes: obtaining the tenant identifier from the request parameters of the navigation request; and matching the corresponding port policy entry from the preset port policy table based on the domain name information of the navigation request and the tenant identifier.

[0011] In one possible implementation, before rewriting the port in the navigation request to the target port, the method further includes: verifying whether the protocol and hostname in the navigation request are within a preloaded security whitelist; if the verification passes, then the port in the navigation request is rewritten to the target port.

[0012] In one possible implementation, after loading the corresponding single-page application page based on the rewritten address, the method further includes: when loading the corresponding single-page application page based on the rewritten address fails, the current port in the rewritten address is rolled back to a preset default port to generate a rollback address; the corresponding single-page application page is reloaded based on the rollback address, and the failure event information is reported.

[0013] Secondly, this application provides a single-page application port adaptive navigation device, comprising: a navigation request interception module, a target port calculation module, a port rewriting module, and a single-page application page loading module; wherein, the navigation request interception module is used to intercept the navigation request for the single-page application by means of a pre-registered URL interception processor when the navigation request for the single-page application is initiated; the target port calculation module is used to calculate the target port based on a preset port policy table and the current running environment state; the port rewriting module is used to rewrite the port in the navigation request to the target port to obtain a rewritten address; and the single-page application page loading module is used to load the corresponding single-page application page based on the rewritten address.

[0014] Thirdly, embodiments of this application also provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described method.

[0015] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the above-described method.

[0016] This application provides a single-page application port adaptive navigation method, apparatus, device, and storage medium, which has the following advantages compared with the prior art: When a navigation request for the single-page application is initiated, this method intercepts the navigation request through a pre-registered URL interceptor; calculates the target port based on a pre-set port policy table and the current operating environment status; rewrites the port in the navigation request to the target port to obtain a rewritten address; and loads the corresponding single-page application page based on the rewritten address. Compared with the prior art, the technical solution of this application registers a URL interceptor when the application starts, which can directly intercept and process the navigation request without relying on backend redirection, thus improving request response efficiency and avoiding the risk of security policy bypass. The method of calculating the target port by combining a pre-set port policy table with the current operating environment status replaces the method of hardcoding the port on the client side, which can flexibly adapt to the dynamic changes of backend service ports and effectively solve the problem of navigation request failure caused by network environment or tunnel state switching. At the same time, the unified port policy table provides a standardized management carrier for differentiated port configurations for multi-tenant and multi-business scenarios, reducing the difficulty of application operation and maintenance and configuration management. Furthermore, the entire process of interception, calculation, and rewriting can serve as a basis for fault tracing, improving the efficiency of problem location and debugging, thereby ensuring the business continuity and overall reliability of enterprise mobile applications. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0020] Figure 1 This is a flowchart illustrating an embodiment of a single-page application port adaptive navigation method provided in this application; Figure 2 This is a schematic diagram of the structure of an embodiment of a single-page application port adaptive navigation device provided in this application; Figure 3 This is a schematic diagram of the structure of a computer device provided in this application. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0022] The following disclosure provides numerous different embodiments or examples for implementing various structures of this application. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of this application. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0023] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0024] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0025] It should also be further understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0026] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrases "if determined" or "if [the described condition or event] is detected" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once [the described condition or event] is detected," or "in response to detection of [the described condition or event]."

[0027] Example 1, see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of a single-page application port adaptive navigation method provided in this application, as shown below. Figure 1As shown, the method includes steps 101-104, as detailed below: Step 101: When a navigation request is initiated for the single-page application, the navigation request is intercepted by a pre-registered URL interception processor.

[0028] In one embodiment, the URL interceptor is registered when the application starts.

[0029] Specifically, the registration of the URL interceptor occurs during the application initialization phase, earlier than any navigation request initiated by a single-page application, and is executed synchronously with the loading of the port policy table and security whitelist. At this time, registering the URL interceptor is to make it a front-end control node for all navigation requests of single-page applications, replacing the traditional scattered port processing logic, centralizing the port management of multiple single-page application entry points, ensuring that all subsequent requests that meet the conditions can be processed according to unified rules, and avoiding adaptation failures caused by configuration lag or scattered logic.

[0030] Specifically, the URL interception processor is used to intercept and rewrite the single-page application entry point on a preset port. Essentially, it establishes a unified URL control entry point during the application startup phase to achieve precise filtering, interception, and port rewriting of specific single-page application requests.

[0031] Preferably, when registering a URL interceptor, a gray-scale configuration list is also loaded synchronously and cached locally along with the port policy table and security whitelist; wherein, the gray-scale configuration list can be dynamically updated through a task queue or remote configuration; the gray-scale configuration list includes pilot object identifiers, new port configuration parameters, and gray-scale activation switches.

[0032] Preferably, when registering a URL interceptor, a configurable path / parameter rewriting callback module is registered simultaneously. This path / parameter rewriting callback module is loaded together with the port policy table and security whitelist, and supports dynamic updates of path rewriting rules, such as path version prefixes, fixed parameter templates and parameter injection strategies, through task queues or remote configuration. The callback module is disabled by default and needs to be manually enabled.

[0033] In one embodiment, the URL interception processor registered when the application starts has been set as the pre-control node for all single-page application navigation requests. Regardless of whether the access to the single-page application is initiated through a web view or native navigation, the navigation request will not be loaded directly, but will be routed to the URL interception processor first, ensuring that all requests that may require port adaptation can be controlled and avoiding omissions or bypasses.

[0034] In one embodiment, the URL interception processor does not intercept all navigation requests, but rather performs precise filtering based on preset conditions, and only intercepts navigation requests that meet the requirements.

[0035] In one embodiment, after the navigation request is intercepted by the URL interception processor, the method further includes: determining whether the target address in the navigation request belongs to a preset list of addresses to be processed; if so, calculating the target port based on a preset port policy table and the current running environment status; otherwise, directly loading the corresponding single-page application page based on the original address in the navigation request.

[0036] In one embodiment, determining whether the target address in the navigation request belongs to a preset list of addresses to be processed specifically includes: determining whether the current situation is a preset business scenario that requires triggering port adaptive processing; if it is in the business scenario, extracting the target path from the target URL in the navigation request and matching the target path with the business interface address in the list of addresses to be processed; if the match is successful, determining that the target address in the navigation request belongs to the preset list of addresses to be processed.

[0037] Specifically, the preset business scenarios that require port adaptive processing are single-page application authentication scenarios or tunnel opening scenarios. The common feature of these scenarios is that the backend port will change dynamically with the switching of the intranet / extranet and the tunnel connection status. If port adaptive processing is not performed, it is very easy to cause access failure or security policy bypass.

[0038] Specifically, the URL interception processor obtains the current business scenario identifier in real time through the associated environment / tunnel status detection module. Only when the business scenario matches the preset business type will it enter the subsequent address matching stage. If it is a scenario such as ordinary browsing that does not require port adaptation, the navigation request is directly allowed, and the corresponding single-page application page is directly loaded based on the original address in the navigation request to ensure processing efficiency.

[0039] Specifically, the URL interceptor will parse the target URL of the navigation request and extract the specific target path from it. This path is the core identifier that distinguishes different business interfaces. In addition, the URL interceptor also has a built-in preset list of addresses to be processed. This list of addresses to be processed is configured by the enterprise according to business needs and clearly includes the addresses of core business interfaces that must be port-adaptive, such as basic configuration interfaces, certificate download interfaces, and single sign-on interfaces. These interfaces are directly associated with backend service ports and are the key objects of port adaptation.

[0040] Specifically, the extracted target path is compared one by one with the business interface addresses in the address list to be processed to verify whether the two are completely consistent or conform to the preset matching rules. If so, the matching is successful and the target address in the navigation request belongs to the preset address list to be processed.

[0041] Specifically, the target address of the navigation request is determined to be in the pre-defined list of addresses to be processed only when the current scenario belongs to a pre-defined business scenario that requires port adaptation processing, and the target path of the target URL matches the business interface address in the list of addresses to be processed. Once the determination is successful, the URL interception processor will initiate the subsequent port adaptation decision, security verification, and URL rewriting process. If the path matching fails, it is determined to be an address that does not need to be processed, and the URL interception processor will allow the navigation request and load the page according to the original address in the navigation request. This ensures the port adaptation requirements of the core business and avoids ineffective intervention in non-core interfaces, achieving precise control.

[0042] Step 102: Calculate the target port based on the preset port policy table and the current operating environment status.

[0043] In one embodiment, the current operating environment status is obtained, wherein the current operating environment status includes at least the tunnel connection status; according to the domain name information in the navigation request, the corresponding port policy entry is matched from a preset port policy table; according to the tunnel connection status, the target port is determined from the port configuration field of the port policy entry; wherein the port policy table includes at least a domain name, a primary domain identifier, and port configuration fields corresponding to different service types, and the port configuration fields include at least a tunnel port for dedicated tunnel access and a single-page application port for single-page application access.

[0044] Specifically, when obtaining the current operating environment status, the tunnel connection status is collected, including the specific status of the tunnel being open, closed, connected, or abnormally disconnected. Preferably, the network environment type, such as the switching status between intranet and extranet, can also be collected to provide supplementary reference for port decision-making and avoid adaptation deviations caused by relying on only a single status.

[0045] Specifically, the data collection process is linked with the URL interception processor, triggering the acquisition of data on the current operating environment status as needed. Only after the URL interception processor intercepts a navigation request from a single-page application that meets the conditions, it actively calls the environment / tunnel status detection module to obtain the latest current operating environment status data, ensuring that the status information used is completely synchronized with the current access scenario, and avoiding port selection errors due to data lag.

[0046] Specifically, the target URL of the navigation request contains explicit domain name information, and the processor extracts this domain name as a matching keyword. The port policy table is a core configuration set that is pre-configured and loaded when the application starts. It contains at least the domain name, the main domain identifier, and port configuration fields corresponding to different business types. It also supports setting priority based on the main domain identifier, such as port policy entries with a main domain identifier of 1 taking precedence. During matching, the processor queries the port policy table for the port policy entry corresponding to the extracted domain name: in the case of a single domain name, it directly matches the port policy entries of the same domain name; in the case of multiple domain names, it can determine the effective port policy entry based on the currently selected domain name entry or the priority of the main domain identifier, ensuring that each domain name can correspond to a dedicated port configuration rule.

[0047] Specifically, the matched port policy entries include port configuration fields such as tunnel port and single-page application port. The URL interception processor will make targeted selections based on the previously obtained tunnel connection status: if the tunnel is in a normal open state, the target port will be determined as the tunnel port under the port policy entry to ensure secure access to backend services through the tunnel; if the tunnel is closed or the connection is abnormal, the single-page application port or the default port under the port policy entry will be selected as the target port to ensure access continuity. The entire process requires no manual intervention and is completely automatically switched by the processor according to the environment status. This not only solves the problem that traditional hard-coded ports cannot adapt to environmental changes, but also ensures the consistency and compliance of port selection through the standardized configuration of the port policy table.

[0048] In one embodiment, the port policy table further includes a tenant identifier.

[0049] Specifically, in enterprise multi-tenant scenarios, different tenants, such as different subsidiaries of a group or partner companies, may have different backend service port configurations. For example, some tenants need to use specific tunnel ports, while others adapt to dedicated intranet ports. The existence of tenant identifiers allows the URL interception processor to quickly locate the tenant to which the current request belongs, avoid confusion in port configurations of different tenants, and ensure that each tenant can adapt to its own rules for port adaptation.

[0050] Specifically, the port policy table will configure one or more policy entries for each tenant. Each entry contains a unique tenant identifier, such as tenant ID and tenant name, as well as the exclusive configuration of the API port, tunnel port, single-page application port, etc., corresponding to that tenant. On the other hand, the tenant identifier is strongly associated with the navigation request. The request parameters of the navigation request will carry the tenant identifier. The URL interception processor can directly extract the tenant identifier from the navigation request as one of the core bases for matching the port policy table.

[0051] In one embodiment, when matching the corresponding port policy entry from the preset port policy table based on the domain name information in the navigation request, the tenant identifier can also be obtained from the request parameters of the navigation request; and the corresponding port policy entry can be matched from the preset port policy table based on the domain name information of the navigation request and the tenant identifier.

[0052] Specifically, the URL interception processor first extracts the tenant identifier and domain name information from the navigation request, and then queries the port policy table in conjunction with it. It prioritizes matching port policy entries that are consistent with both the tenant identifier and domain name information in the navigation request. If such an entry exists, the tenant-specific port under that port policy entry is directly called as the target port. If no match is found, the default port is used as the target port. This matching logic not only ensures the accurate effectiveness of the tenant-specific port policy, but also perfectly solves the problem that traditional solutions cannot meet the differentiated port requirements of multiple tenants, allowing applications to flexibly adapt to multi-tenant shared enterprise office scenarios.

[0053] In one embodiment, it can also be determined whether the object initiating the navigation request belongs to the grayscale configuration list. If the object initiating the navigation request belongs to the pilot object in the grayscale configuration list and the grayscale switch is enabled, then the new port parameter in the grayscale configuration list is used as the target port candidate first. If the object initiating the navigation request is not a pilot object or the grayscale switch is not enabled, the target port is still calculated according to the above port strategy table.

[0054] In one embodiment, after calculating the target port, the first-level extended processing of the configurable path / parameter rewriting callback module can also be triggered. If the path / parameter extension function is enabled, the URL interception processor will call the path / parameter rewriting callback module to synchronously complete operations such as port rewriting, path rewriting / parameter appending according to preset rules. For example, for path rewriting: add a version prefix to the interface path and replace the old path with the new path. The specific rules are read from the path rewriting rules of the path / parameter rewriting callback module. For parameter injection: extract tenant identifier and device information from the request context, or append fixed parameters according to the template to ensure that the parameters are adapted to business requirements.

[0055] Step 103: Rewrite the port in the navigation request to the target port to obtain the rewritten address.

[0056] In one embodiment, before rewriting the port in the navigation request to the target port, the method further includes: verifying whether the protocol and hostname in the navigation request are within a preloaded security whitelist; if the verification passes, then the port in the navigation request is rewritten to the target port.

[0057] Specifically, the security whitelist is not generated temporarily, but is extracted from the forwarding rules and domain name resolution rules returned by the gateway authentication during the application startup initialization phase and preloaded into the local core security configuration. The whitelist explicitly includes legal protocol types and trusted hostnames / domains recognized by the enterprise, such as enterprise intranet domains and business domains that have been filed.

[0058] Specifically, after calculating the target port and before performing port rewriting, the URL interception processor actively parses the target URL of the navigation request, separates the protocol field and hostname field, and compares them with the pre-loaded security whitelist. The protocol verification focuses on whether it is a secure transmission protocol specified by the enterprise to avoid the risk of data leakage caused by plaintext transmission. The hostname verification verifies whether it is a trusted domain name of the enterprise, blocks requests corresponding to unfamiliar or malicious hostnames, and prevents illegal requests from penetrating the backend service through port rewriting from the source.

[0059] Specifically, when both the protocol and hostname verifications pass, it indicates that the navigation request originates from a legitimate source and is transmitted securely. This triggers a port rewriting operation to ensure the security and compliance of the port adaptive process. At this point, the URL interception processor will accurately replace the original port number in the target URL of the navigation request with the previously calculated target port, generating a compliant and environment-adaptive rewritten address. The entire rewriting process only targets the port field and does not modify other core information such as the protocol and hostname in the URL, ensuring that the business orientation of the request does not deviate.

[0060] Specifically, if either the protocol or the hostname fails verification, the processor will directly block the port rewriting process. It will neither perform port replacement nor load the page corresponding to the request. At the same time, it can trigger an exception reporting mechanism to record and report the relevant information of the illegal request to the enterprise operation and maintenance end, which is convenient for security audit and risk tracing. This logic not only ensures the implementation of the core function of port auto-adaptation, but also avoids the security vulnerabilities caused by the lack of protection in traditional solutions through security verification, thus achieving a unity of functionality and security.

[0061] In one embodiment, in addition to verifying whether the protocol and hostname in the navigation request are within the preloaded security whitelist, the target server in the navigation request can also be further verified with a digital certificate.

[0062] Specifically, whitelist verification mainly addresses basic compliance issues such as whether requests originate from legitimate domains and use security protocols, but it cannot verify the true identity of the target server, potentially leading to risks such as domain name forgery and man-in-the-middle attacks. For example, malicious entities could impersonate hostnames within the whitelist to set up fake servers. Digital certificate verification, on the other hand, focuses on the authenticity of the target server's identity and the integrity of data transmission. Through digital certificates issued by authoritative institutions, it verifies whether the target server is a legitimate service node recognized by the enterprise, ensuring that data is not tampered with or eavesdropped on during request transmission. It strengthens and supplements basic security verification.

[0063] Specifically, when verifying the digital certificate of the target server in the navigation request, the URL interception processor will send a certificate retrieval request to the target server of the navigation request. After obtaining the digital certificate returned by the server, it will perform multiple verifications according to preset rules: First, it verifies whether the digital certificate is in the enterprise's pre-trusted list to exclude unauthorized certificates; second, it verifies the validity of the digital certificate, including whether the certificate has expired, whether it has been revoked, and whether the issuing authority is legitimate; third, it verifies whether the domain name bound to the digital certificate is consistent with the target hostname of the navigation request to prevent spoofing scenarios where the certificate and domain name do not match; fourth, it verifies the integrity of data transmission through the public key of the digital certificate to ensure that the navigation request has not been tampered with during transmission.

[0064] Specifically, if the digital certificate verification passes, it indicates that the target server's identity is authentic and the transmission link is secure. The URL interception processor will continue to perform the port rewriting operation, replacing the original port with the target port, generating a secure and compliant rewritten address, and triggering page loading. If the certificate verification fails, the port rewriting and request loading process will be directly blocked to prevent unauthorized servers from accessing the server.

[0065] Step 104: Load the corresponding single-page application page based on the rewritten address.

[0066] In one embodiment, the URL interception processor passes the rewritten address to the corresponding navigation component. If it is a single-page application page with an embedded WebView, a request is initiated through the URL loading interface of the WebView, and the page is rendered according to the web page loading logic. If it is a native navigation mode, the native page jump interface of the application is called to access the backend single-page application service based on the rewritten address and load the page. The entire execution process does not require manual intervention and is completed by the processor and navigation component working together to ensure the smoothness and consistency of the loading process.

[0067] In one embodiment, if the single-page application page corresponding to the rewritten address loads successfully, the corresponding single-page application page is directly presented, completing the navigation loop; if loading fails due to network fluctuations, temporary unavailability of backend services, or other reasons, the URL interception processor will immediately trigger a fallback mechanism.

[0068] In one embodiment, after loading the corresponding single-page application page based on the rewritten address, the method further includes: when loading the corresponding single-page application page based on the rewritten address fails, the current port in the rewritten address is rolled back to a preset default port to generate a rollback address; the corresponding single-page application page is reloaded based on the rollback address, and the failure event information is reported.

[0069] Specifically, the port in the rewritten address is restored to the preset default port, and the loading request is re-initiated. At the same time, the failure event information of the loading failure is recorded, such as the original address, the rewritten address, the reason for failure, and the current environment status, and reported to the operation and maintenance end to provide a basis for problem localization. This linkage logic of loading and rollback not only ensures adaptive access in normal scenarios, but also copes with sudden anomalies, and maximizes the protection of business continuity.

[0070] In one embodiment, when recording failure event information for loading failure, in addition to the original address and rewritten address, additional information such as grayscale identifier, new port configuration version, and loading status is marked for pilot requests in the grayscale configuration list; if the new port request of the pilot object fails to access or has an adaptation anomaly, in addition to performing default port rollback and reporting, it is supported to turn off the grayscale switch of the pilot object with one click, quickly roll back to the original port configuration, and reduce the scope of impact.

[0071] In one embodiment, before loading the corresponding single-page application page based on the rewritten address, a second-level extended processing of the path / parameter rewriting callback module can be triggered; this is used to call the path / parameter rewriting callback module again to perform a second rewriting / injection on the rewritten address that has completed the first round of rewriting, so as to regenerate a new rewritten address.

[0072] Specifically, the secondary rewriting / injection of the rewritten address focuses on adapting to the special needs of embedded components, such as supplementing cross-domain adaptation parameters for WebView components and adding page rendering parameters to the native navigation address to ensure compatibility between the address and the navigation carrier.

[0073] Preferably, for HarmonyOS, dynamic parameter appending is triggered before the page is displayed, such as extracting real-time parameters from the application's current context and dynamically injecting them into the address to adapt to the system's page rendering mechanism.

[0074] Example 2, see Figure 2 , Figure 2This is a schematic diagram of an embodiment of a single-page application port adaptive navigation device provided in this application. Corresponding to the above-described single-page application port adaptive navigation method, this application also provides a single-page application port adaptive navigation device. This single-page application port adaptive navigation device includes modules for executing the above-described single-page application port adaptive navigation method, and can be configured in terminals such as desktop computers, tablet computers, and laptops; specifically, the single-page application port adaptive navigation device includes a navigation request interception module 201, a target port calculation module 202, a port rewriting module 203, and a single-page application page loading module 204.

[0075] The navigation request interception module 201 is used to intercept the navigation request by a pre-registered URL interception processor when a navigation request for the single-page application is initiated.

[0076] The target port calculation module 202 is used to calculate the target port based on a preset port policy table and the current operating environment status.

[0077] The port rewriting module 203 is used to rewrite the port in the navigation request to the target port to obtain the rewritten address.

[0078] The single-page application loading module 204 is used to load the corresponding single-page application page based on the rewritten address.

[0079] In one embodiment, the navigation request interception module 201, after intercepting the navigation request through the URL interception processor, further includes: determining whether the target address in the navigation request belongs to a preset list of addresses to be processed; if so, calculating the target port based on a preset port policy table and the current running environment status; otherwise, directly loading the corresponding single-page application page based on the original address in the navigation request.

[0080] In one embodiment, the navigation request interception module 201 is used to determine whether the target address in the navigation request belongs to a preset list of addresses to be processed. Specifically, it includes: determining whether the current situation is a preset business scenario that requires triggering port adaptive processing; if it is in the business scenario, extracting the target path from the target URL in the navigation request and matching the target path with the business interface address in the list of addresses to be processed; if the match is successful, determining that the target address in the navigation request belongs to the preset list of addresses to be processed.

[0081] In one embodiment, the target port calculation module 202 is used to calculate a target port based on a preset port policy table and the current operating environment status. Specifically, it includes: obtaining the current operating environment status, wherein the current operating environment status includes at least the tunnel connection status; matching the corresponding port policy entry from the preset port policy table according to the domain name information in the navigation request; and determining the target port from the port configuration field of the port policy entry according to the tunnel connection status. The port policy table includes at least a domain name, a primary domain identifier, and port configuration fields corresponding to different service types. The port configuration fields include at least a tunnel port for dedicated tunnel access and a single-page application port for single-page application access.

[0082] In one embodiment, the port policy table further includes a tenant identifier. The target port calculation module 202 is used to match a corresponding port policy entry from a preset port policy table based on the domain name information in the navigation request. Specifically, this includes: obtaining the tenant identifier from the request parameters of the navigation request; and matching a corresponding port policy entry from the preset port policy table based on the domain name information of the navigation request and the tenant identifier.

[0083] In one embodiment, the port rewriting module 203, before rewriting the port in the navigation request to the target port, further includes: verifying whether the protocol and hostname in the navigation request are within a preloaded security whitelist; if the verification passes, then rewriting the port in the navigation request to the target port.

[0084] In one embodiment, the single-page application loading module 204, after loading the corresponding single-page application based on the rewritten address, further includes: when loading the corresponding single-page application based on the rewritten address fails, reverting the current port in the rewritten address to a preset default port to generate a fallback address; reloading the corresponding single-page application based on the fallback address, and reporting the failure event information.

[0085] The single-page application port adaptive navigation device described above can implement the single-page application port adaptive navigation method of the above method embodiments. The options in the above method embodiments are also applicable to this embodiment, and will not be detailed here.

[0086] like Figure 3 As shown, Figure 3 This is a schematic diagram of the structure of a computer device provided in this application; it includes a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112 and the memory 113 communicate with each other through the communication bus 114, and the memory 113 is used to store computer programs.

[0087] In one embodiment of this application, when the processor 111 executes the program stored in the memory 113, it implements the single-page application port adaptive navigation method provided in any of the foregoing method embodiments.

[0088] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program may be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.

[0089] Therefore, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the single-page application port adaptive navigation method provided in any of the foregoing method embodiments.

[0090] The storage medium is a physical, non-transient storage medium, such as a USB flash drive, external hard drive, read-only memory (ROM), magnetic disk, or optical disk, or any other physical storage medium capable of storing program code. The computer-readable storage medium can be non-volatile or volatile.

[0091] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.

[0092] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0093] The steps in the methods of this application embodiment can be adjusted, merged, or deleted according to actual needs. The units in the apparatus of this application embodiment can be merged, divided, or deleted according to actual needs. Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0094] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.

[0095] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0096] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Since these modifications and variations fall within the scope of the claims and their equivalents, this application also intends to include these modifications and variations.

[0097] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A single-page application port adaptive navigation method, characterized in that, include: When a navigation request is initiated for the single-page application, the navigation request is intercepted by a pre-registered URL interception processor; Calculate the target port based on the preset port policy table and the current operating environment status; The port in the navigation request is rewritten to the target port to obtain the rewritten address; The corresponding single-page application page is loaded based on the rewritten address.

2. The single-page application port adaptive navigation method as described in claim 1, characterized in that, After intercepting the navigation request via the URL interception processor, the method further includes: Determine whether the target address in the navigation request belongs to the preset list of addresses to be processed. If so, calculate the target port based on the preset port policy table and the current running environment status. Otherwise, directly load the corresponding single-page application page based on the original address in the navigation request.

3. The single-page application port adaptive navigation method as described in claim 2, characterized in that, The step of determining whether the target address in the navigation request belongs to a preset list of addresses to be processed specifically includes: Determine whether the current situation is within a preset business scenario that requires triggering port adaptive processing; If the business scenario is as described above, the target path in the target URL of the navigation request is extracted, and the target path is matched with the business interface address in the list of addresses to be processed. If a match is found, the target address in the navigation request is determined to be part of a preset list of addresses to be processed.

4. The single-page application port adaptive navigation method as described in claim 1, characterized in that, The calculation of the target port based on the preset port policy table and the current operating environment status specifically includes: Obtain the current operating environment status, wherein the current operating environment status includes at least the tunnel connection status; Based on the domain name information in the navigation request, match the corresponding port policy entry from the preset port policy table; Based on the tunnel connection status, the target port is determined from the port configuration field of the port policy entry; The port policy table includes at least a domain name, a primary domain identifier, and port configuration fields corresponding to different service types. The port configuration fields include at least a tunnel port for dedicated tunnel access and a single-page application port for single-page application access.

5. The single-page application port adaptive navigation method as described in claim 1, characterized in that, The port policy table also includes a tenant identifier. The step of matching the corresponding port policy entry from the preset port policy table based on the domain name information in the navigation request specifically includes: Obtain the tenant identifier from the request parameters of the navigation request; Based on the domain name information of the navigation request and the tenant identifier, the corresponding port policy entry is matched from the preset port policy table.

6. The single-page application port adaptive navigation method as described in claim 1, characterized in that, Before rewriting the port in the navigation request to the target port, the method further includes: Verify whether the protocol and hostname in the navigation request are within the preloaded security whitelist; If the verification passes, the port in the navigation request will be rewritten to the target port.

7. The single-page application port adaptive navigation method as described in claim 1, characterized in that, After loading the corresponding single-page application page based on the rewritten address, the process further includes: When loading the corresponding single-page application page based on the rewritten address fails, the current port in the rewritten address is rolled back to the preset default port to generate a rollback address; Reload the corresponding single-page application based on the fallback address and report the failure event information.

8. A single-page application port adaptive navigation device, characterized in that, include: Navigation request interception module, target port calculation module, port rewriting module, and single-page application page loading module; The navigation request interception module is used to intercept the navigation request by a pre-registered URL interception processor when a navigation request for the single-page application is initiated. The target port calculation module is used to calculate the target port based on a preset port policy table and the current operating environment status. The port rewriting module is used to rewrite the port in the navigation request to the target port to obtain the rewritten address; The single-page application loading module is used to load the corresponding single-page application page based on the rewritten address.

9. A computer device, characterized in that, The computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, can implement the method as described in any one of claims 1-7.