mirror of https://github.com/rancher/ui.git
Fix healthcheck http headers field issue
https://github.com/rancher/rancher/issues/16853
This commit is contained in:
parent
02a53c3815
commit
f9176924fe
|
|
@ -60,15 +60,18 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( type === HTTP || type === HTTPS ) {
|
if ( type === HTTP || type === HTTPS ) {
|
||||||
const originalHeaders = get(check, 'httpHeaders') || {};
|
const originalHeaders = get(check, 'httpHeaders') || [];
|
||||||
let host = null;
|
let host = null;
|
||||||
const headers = {};
|
const headers = {};
|
||||||
|
|
||||||
Object.keys(originalHeaders).forEach((key) => {
|
originalHeaders.forEach((h) => {
|
||||||
if ( key.toLowerCase() === 'host' ) {
|
const name = (get(h, 'name') || '');
|
||||||
host = originalHeaders[key];
|
const value = (get(h, 'value') || '');
|
||||||
|
|
||||||
|
if ( name.toLowerCase() === 'host' ) {
|
||||||
|
host = value;
|
||||||
} else {
|
} else {
|
||||||
headers[key] = originalHeaders[key];
|
set(headers, name, value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -114,16 +117,26 @@ export default Component.extend({
|
||||||
|
|
||||||
if ( get(this, 'isHttpish') ) {
|
if ( get(this, 'isHttpish') ) {
|
||||||
const host = get(this, 'host');
|
const host = get(this, 'host');
|
||||||
const hostHeader = {};
|
const httpHeaders = [];
|
||||||
|
|
||||||
if ( host ) {
|
if ( host ) {
|
||||||
hostHeader['Host'] = host;
|
httpHeaders.push({
|
||||||
|
name: 'Host',
|
||||||
|
value: host
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const headers = Object.assign({}, hostHeader, get(this, 'headers'));
|
const headers = get(this, 'headers');
|
||||||
|
|
||||||
|
Object.keys(headers).forEach((header) => {
|
||||||
|
httpHeaders.push({
|
||||||
|
name: header,
|
||||||
|
value: get(headers, header)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
setProperties(check, {
|
setProperties(check, {
|
||||||
httpHeaders: headers,
|
httpHeaders,
|
||||||
path: get(this, 'path') || '/',
|
path: get(this, 'path') || '/',
|
||||||
scheme: get(this, 'isHttps') ? 'HTTPS' : 'HTTP'
|
scheme: get(this, 'isHttps') ? 'HTTPS' : 'HTTP'
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue