diff --git a/client/src/components/Settings/Encryption/Form.js b/client/src/components/Settings/Encryption/Form.js
index ac0e0577..b52c6f78 100644
--- a/client/src/components/Settings/Encryption/Form.js
+++ b/client/src/components/Settings/Encryption/Form.js
@@ -199,22 +199,33 @@ let Form = (props) => {
: encryption_chain_invalid
}
- {subject &&
-
encryption_subject: {subject}
- }
- {issuer &&
- encryption_issuer: {issuer}
- }
- {not_after && not_after !== EMPTY_DATE &&
-
- encryption_expire:
- {format(not_after, 'YYYY-MM-DD HH:mm:ss')}
-
- }
- {dns_names &&
-
- encryption_hostnames: {dns_names}
-
+ {valid_cert &&
+
+ {subject &&
+
+ encryption_subject:
+ {subject}
+
+ }
+ {issuer &&
+
+ encryption_issuer:
+ {issuer}
+
+ }
+ {not_after && not_after !== EMPTY_DATE &&
+
+ encryption_expire:
+ {format(not_after, 'YYYY-MM-DD HH:mm:ss')}
+
+ }
+ {dns_names &&
+
+ encryption_hostnames:
+ {dns_names}
+
+ }
+
}
diff --git a/client/src/components/Settings/Encryption/index.js b/client/src/components/Settings/Encryption/index.js
index 8a57e028..4c5ddf27 100644
--- a/client/src/components/Settings/Encryption/index.js
+++ b/client/src/components/Settings/Encryption/index.js
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import { withNamespaces } from 'react-i18next';
import debounce from 'lodash/debounce';
+import { DEBOUNCE_TIMEOUT } from '../../../helpers/constants';
import Form from './Form';
import Card from '../../ui/Card';
@@ -13,7 +14,7 @@ class Encryption extends Component {
handleFormChange = debounce((values) => {
this.props.validateTlsConfig(values);
- }, 300);
+ }, DEBOUNCE_TIMEOUT);
render() {
const { encryption, t } = this.props;
diff --git a/client/src/helpers/constants.js b/client/src/helpers/constants.js
index 74a39a8f..1964f38e 100644
--- a/client/src/helpers/constants.js
+++ b/client/src/helpers/constants.js
@@ -73,8 +73,13 @@ export const SETTINGS_NAMES = {
export const STANDARD_DNS_PORT = 53;
export const STANDARD_WEB_PORT = 80;
+
export const EMPTY_DATE = '0001-01-01T00:00:00Z';
+export const DEBOUNCE_TIMEOUT = 300;
+export const CHECK_TIMEOUT = 1000;
+export const STOP_TIMEOUT = 10000;
+
export const UNSAFE_PORTS = [
1,
7,
diff --git a/client/src/helpers/helpers.js b/client/src/helpers/helpers.js
index 22760bd5..b79874a9 100644
--- a/client/src/helpers/helpers.js
+++ b/client/src/helpers/helpers.js
@@ -4,7 +4,13 @@ import subHours from 'date-fns/sub_hours';
import addHours from 'date-fns/add_hours';
import round from 'lodash/round';
-import { STATS_NAMES, STANDARD_DNS_PORT, STANDARD_WEB_PORT } from './constants';
+import {
+ STATS_NAMES,
+ STANDARD_DNS_PORT,
+ STANDARD_WEB_PORT,
+ CHECK_TIMEOUT,
+ STOP_TIMEOUT,
+} from './constants';
export const formatTime = (time) => {
const parsedTime = dateParse(time);
@@ -151,7 +157,19 @@ export const redirectToCurrentProtocol = (values) => {
if (protocol !== 'https:' && enabled && port_https) {
window.location.replace(`https://${hostname}${httpsPort}/${hash}`);
} else if (protocol === 'https:' && enabled && port_https && port_https !== port) {
- window.location.replace(`https://${hostname}${httpsPort}/${hash}`);
+ // TODO
+ const redirectCheck = setInterval(() => {
+ fetch(`https://${hostname}${httpsPort}/${hash}`, { mode: 'no-cors' })
+ .then(() => {
+ clearInterval(redirectCheck);
+ window.location.replace(`https://${hostname}${httpsPort}/${hash}`);
+ })
+ .catch(() => false);
+ }, CHECK_TIMEOUT);
+ setTimeout(() => {
+ clearInterval(redirectCheck);
+ console.error('Redirect check stopped');
+ }, STOP_TIMEOUT);
} else if (protocol === 'https:' && (!enabled || !port_https)) {
window.location.replace(`http://${hostname}/${hash}`);
}