Support the X-Forwarded-Proto insertion header

This is a follow up of Id017bb277eebae98f0441663e41d07b40b6e3e38,
which added support for the X-Forwarded-Proto insertion header on
listeners.

Change-Id: Ifdf73015e12fea1ddac2c6168f34f1c452a9a9cb
Story: 2004165
Task: 27642
This commit is contained in:
Jacky Hu 2018-10-09 20:29:14 +08:00
parent b4bfea8545
commit 90aa0f41f4
4 changed files with 38 additions and 3 deletions

View File

@ -34,7 +34,7 @@
<strong translate>Insert Headers:</strong>
<translate>
Additional headers insertion into HTTP header,
only "X-Forwarded-For" and "X-Forwarded-Port" are supported.
only "X-Forwarded-For", "X-Forwarded-Port" and "X-Forwarded-Proto" are supported.
</translate>
</p>
<p>

View File

@ -184,7 +184,22 @@
id="x_forwarded_port"
ng-model="model.spec.listener.insert_headers['X-Forwarded-Port']">
<label for="x_forwarded_port">
<span translate>X-Forwarded-port</span>
<span translate>X-Forwarded-Port</span>
</label>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6">
<div class="form-group">
<div class="themable-checkbox">
<input type="checkbox"
ng-true-value="'True'"
ng-false-value="''"
id="x_forwarded_proto"
ng-model="model.spec.listener.insert_headers['X-Forwarded-Proto']">
<label for="x_forwarded_proto">
<span translate>X-Forwarded-Proto</span>
</label>
</div>
</div>

View File

@ -37,7 +37,8 @@
sni_container_refs: ['container2'],
insert_headers: {
'X-Forwarded-For': 'True',
'X-Forwarded-Port': 'True'
'X-Forwarded-Port': 'True',
'X-Forwarded-Proto': 'True'
}
},
pool: {
@ -2490,6 +2491,20 @@
});
});
describe('Model visible resources (edit listener, no x forwared proto)', function() {
beforeEach(function() {
delete listenerResources.listener.insert_headers['X-Forwarded-Proto'];
delete listenerResources.pool;
model.initialize('listener', '1234');
scope.$apply();
});
it('should only show listener details', function() {
expect(model.context.resource).toEqual('listener');
});
});
describe('Model visible resources (edit listener, no pool)', function() {
beforeEach(function() {

View File

@ -0,0 +1,5 @@
---
features:
- |
Adds the ability to set the X-Forwarded-Proto insertion header on
listeners.