Merge "Adding support for the octavia listener X-Forwarded-Proto header insertion."

This commit is contained in:
Zuul 2018-07-11 00:26:04 +00:00 committed by Gerrit Code Review
commit f755657f17
5 changed files with 52 additions and 26 deletions

View File

@ -164,18 +164,24 @@ Supported HTTP Header Insertions
header insertions.
+------------------+--------+------------------------------------------------+
| Key | Value | Description |
+==================+========+================================================+
| X-Forwarded-For | string | When "``true``" a ``X-Forwarded-For`` header |
| | | is inserted into the request to the backend |
| | | ``member`` that specifies the client IP |
| | | address. |
+------------------+--------+------------------------------------------------+
| X-Forwarded-Port | string | When "``true``" a ``X-Forwarded-Port`` header |
| | | is inserted into the request to the backend |
| | | ``member`` that specifies the listener port. |
+------------------+--------+------------------------------------------------+
+-------------------+--------+------------------------------------------------+
| Key | Value | Description |
+===================+========+================================================+
| X-Forwarded-For | string | When "``true``" a ``X-Forwarded-For`` header |
| | | is inserted into the request to the backend |
| | | ``member`` that specifies the client IP |
| | | address. |
+-------------------+--------+------------------------------------------------+
| X-Forwarded-Port | string | When "``true``" a ``X-Forwarded-Port`` header |
| | | is inserted into the request to the backend |
| | | ``member`` that specifies the listener port. |
+-------------------+--------+------------------------------------------------+
| X-Forwarded-Proto | string | When "``true``" a ``X-Forwarded-Proto`` header |
| | | is inserted into the request to the backend |
| | | ``member``. HTTP for the HTTP listener |
| | | protocol type, HTTPS for the TERMINATED_HTTPS |
| | | listener protocol type. |
+-------------------+--------+------------------------------------------------+
Request Example
----------------

View File

@ -445,19 +445,25 @@ contains the following:
As of the writing of this specification the Supported HTTP Header Insertions
are:
+-------------------+------+------------------------------------------------+
| Key | Type | Description |
+===================+======+================================================+
| X-Forwarded-For | bool | When True a X-Forwarded-For header is inserted |
| | | into the request to the backend member that |
| | | specifies the client IP address. |
+-------------------+------+------------------------------------------------+
| X-Forwarded-Port | int | A X-Forwarded-Port header is inserted into the |
| | | request to the backend member that specifies |
| | | the integer provided. Typically this is used to|
| | | indicate the port the client connected to on |
| | | the load balancer. |
+-------------------+------+------------------------------------------------+
+-------------------+--------+------------------------------------------------+
| Key | Type | Description |
+===================+========+================================================+
| X-Forwarded-For | bool | When True a X-Forwarded-For header is inserted |
| | | into the request to the backend member that |
| | | specifies the client IP address. |
+-------------------+--------+------------------------------------------------+
| X-Forwarded-Port | int | A X-Forwarded-Port header is inserted into the |
| | | request to the backend member that specifies |
| | | the integer provided. Typically this is used to|
| | | indicate the port the client connected to on |
| | | the load balancer. |
+-------------------+--------+------------------------------------------------+
| X-Forwarded-Proto | bool | A X-Forwarded-Proto header is inserted into |
| | | the end of request to the backend member. |
| | | HTTP for the HTTP listener protocol type, |
| | | HTTPS for the TERMINATED_HTTPS listener |
| | | protocol type. |
+-------------------+--------+------------------------------------------------+
**Creating a Fully Populated Listener**

View File

@ -422,7 +422,8 @@ AMPHORA_NAMESPACE = 'amphora-haproxy'
# List of HTTP headers which are supported for insertion
SUPPORTED_HTTP_HEADERS = ['X-Forwarded-For',
'X-Forwarded-Port']
'X-Forwarded-Port',
'X-Forwarded-Proto']
FLOW_DOC_TITLES = {'AmphoraFlows': 'Amphora Flows',
'LoadBalancerFlows': 'Load Balancer Flows',

View File

@ -257,6 +257,15 @@ backend {{ pool.id }}
http-request set-header X-Forwarded-Port %[dst_port]
{% endif %}
{% endif %}
{% if listener.insert_headers.get('X-Forwarded-Proto',
'False').lower() == 'true' %}
{% if listener.protocol.lower() == constants.PROTOCOL_HTTP.lower() %}
http-request set-header X-Forwarded-Proto http
{% elif listener.protocol.lower() ==
constants.PROTOCOL_TERMINATED_HTTPS.lower() %}
http-request set-header X-Forwarded-Proto https
{% endif %}
{% endif %}
{% if listener.connection_limit is defined %}
fullconn {{ listener.connection_limit }}
{% endif %}

View File

@ -0,0 +1,4 @@
---
features:
- |
Adding support for the listener X-Forwarded-Proto header insertion.