This is an automated email from the ASF dual-hosted git repository.

young pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new c356ab762 fix: remove ssl check in redirect https (#2770)
c356ab762 is described below

commit c356ab762eb377d026e6d1ef530392bfcebb0584
Author: Baoyuan <baoyuan....@gmail.com>
AuthorDate: Wed Mar 22 18:01:32 2023 +0800

    fix: remove ssl check in redirect https (#2770)
---
 .../create-edit-route-with-redirect-plugin.cy.js   | 40 ++++++++++++++++++++++
 web/src/pages/Route/Create.tsx                     | 17 +++------
 2 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/web/cypress/e2e/route/create-edit-route-with-redirect-plugin.cy.js 
b/web/cypress/e2e/route/create-edit-route-with-redirect-plugin.cy.js
index f3f779c7d..05bae93b1 100644
--- a/web/cypress/e2e/route/create-edit-route-with-redirect-plugin.cy.js
+++ b/web/cypress/e2e/route/create-edit-route-with-redirect-plugin.cy.js
@@ -26,6 +26,7 @@ context('Create Edit and Delete Route with redirect plugin', 
() => {
     name: '#name',
     redirect: '[data-cy=route-redirect]',
     customRedirectSelectOpt: '#redirectOption_list_1',
+    httpsRedirectSelectOpt: '#redirectOption_list_2',
     customRedirectUrI: '#redirectURI',
     customRedirectCode: '[data-cy=redirect_code]',
     customRedirectLabel: "[title='Custom Redirect']",
@@ -34,10 +35,13 @@ context('Create Edit and Delete Route with redirect 
plugin', () => {
     notification: '.ant-notification-notice-message',
     webSocketSelector: '[title=WebSocket]',
     enable_websocket_button: '#enable_websocket',
+    hosts_0: '#hosts_0',
+    nodes_0_host: '#submitNodes_0_host',
   };
 
   const data = {
     customRedirectUrI: '/test',
+    host1: 'test.com',
     submitSuccess: 'Submit Successfully',
     deleteRouteSuccess: 'Delete Route Successfully',
     step2Title: 'Define API Backend Server',
@@ -130,4 +134,40 @@ context('Create Edit and Delete Route with redirect 
plugin', () => {
     cy.get(selector.notification).should('contain', data.deleteRouteSuccess);
     cy.get(selector.notificationCloseIcon).click({ multiple: true });
   });
+
+  it('should enable https redirect without ssl', () => {
+    cy.visit('/');
+    cy.contains('Route').click();
+    cy.wait(timeout * 2);
+    cy.get(selector.empty).should('be.visible');
+    cy.contains('Create').click();
+    cy.wait(timeout * 2);
+    cy.contains('Next').click();
+    cy.contains('Next').click();
+    cy.get(selector.name).type(name);
+    cy.get(selector.redirect).click();
+    cy.contains('Enable HTTPS').click({ force: true });
+
+    cy.get(selector.hosts_0).type(data.host1);
+    cy.contains('Next').click();
+    cy.get(selector.nodes_0_host).type(data.host1);
+    cy.contains('Next').click();
+    cy.contains('Next').click();
+    cy.contains('Submit').click();
+    cy.contains(data.submitSuccess);
+    cy.contains('Goto List').click();
+    cy.url().should('contains', 'routes/list');
+
+    cy.get(selector.name).focus().clear().type(name);
+    cy.contains('Search').click();
+    cy.contains(name).siblings().contains('More').click();
+    cy.contains('Delete').click();
+    cy.get(selector.deleteAlert)
+      .should('be.visible')
+      .within(() => {
+        cy.contains('OK').click();
+      });
+    cy.get(selector.notification).should('contain', data.deleteRouteSuccess);
+    cy.get(selector.notificationCloseIcon).click({ multiple: true });
+  });
 });
diff --git a/web/src/pages/Route/Create.tsx b/web/src/pages/Route/Create.tsx
index d0240bf6a..71fcb6a59 100644
--- a/web/src/pages/Route/Create.tsx
+++ b/web/src/pages/Route/Create.tsx
@@ -31,7 +31,7 @@ import Step2 from './components/Step2';
 import Step3 from './components/Step3';
 import { DEFAULT_STEP_1_DATA, DEFAULT_STEP_3_DATA } from './constants';
 import styles from './Create.less';
-import { checkHostWithSSL, checkUniqueName, create, fetchItem, update } from 
'./service';
+import { checkUniqueName, create, fetchItem, update } from './service';
 import { transformProxyRewrite2Plugin } from './transform';
 
 const { Step } = Steps;
@@ -260,17 +260,10 @@ const Page: React.FC<Props> = (props) => {
     if (nextStep === 2) {
       if (step === 1) {
         form1.validateFields().then((value) => {
-          const { redirectOption, hosts } = value;
-          const filterHosts = hosts.filter(Boolean);
-          Promise.all([
-            redirectOption === 'forceHttps' && filterHosts.length !== 0
-              ? checkHostWithSSL(hosts)
-              : Promise.resolve(),
-            checkUniqueName(
-              value.name,
-              props.route.path.indexOf('edit') > 0 ? (props as 
any).match.params.rid : '',
-            ),
-          ]).then(() => {
+          checkUniqueName(
+            value.name,
+            props.route.path.indexOf('edit') > 0 ? (props as 
any).match.params.rid : '',
+          ).then(() => {
             setStep(nextStep);
           });
         });

Reply via email to