diff --git a/lib/liberty_buildpack/container/liberty.rb b/lib/liberty_buildpack/container/liberty.rb index 68c779154..0dbd11c6d 100644 --- a/lib/liberty_buildpack/container/liberty.rb +++ b/lib/liberty_buildpack/container/liberty.rb @@ -460,7 +460,6 @@ def get_context_root def update_http_endpoint(server_xml_doc) endpoints = REXML::XPath.match(server_xml_doc, '/server/httpEndpoint') - if endpoints.empty? endpoint = REXML::Element.new('httpEndpoint', server_xml_doc.root) endpoint.add_attribute('id', 'defaultHttpEndpoint') @@ -474,7 +473,11 @@ def update_http_endpoint(server_xml_doc) endpoint.add_attribute('host', '*') end endpoint.add_attribute('httpPort', "${#{KEY_HTTP_PORT}}") - endpoint.add_element('compression') if endpoint.elements['compression'].nil? + + compression = REXML::XPath.match(server_xml_doc, '/server/compression') + if compression.empty? + endpoint.add_element('compression') if endpoint.elements['compression'].nil? + end endpoint.delete_attribute('httpsPort') end