配置 httpEndpoint 使用非預設 SSL 配置

依預設,httpEndpoint 元素會使用伺服器預設 SSL 配置 defaultSSLConfig。 您可以配置 httpEndpoint 來使用預設 SSL 配置以外的 SSL 配置。

關於這項作業

您可以用多種方式配置 httpEndpoint 來使用預設 SSL 配置。 下列範例顯示配置 httpEndpoint 來使用預設 SSL 配置以外的 SSL 配置的方法。

程序

  • 直接在 httpEndpoint 上設定 SSL 選項。
    下列範例顯示如何在 httpEndpoint 上設定 SSL 選項,它假設您有一個已定義好,且不在這個範例中的 SSL 配置,名稱為 wasListenerSSLConfig:
    <httpEndpoint id="defaultHttpEndpoint"
      host="${listener.host}"
      httpPort="${http.port}"
      httpsPort="${https.port}">
      <sslOptions sslRef="wasListenerSSLConfig" />
    </httpEndpoint>
  • 參照 httpEndpoint 中的 sslOption 元素。
    下列範例顯示如何參照 sslOption 元素,它假設您有一個已定義好,且不在這個範例中的 SSL 配置,名稱為 wasListenerSSLConfig:
    <sslOptions id="mySSLOptions" sslRef="wasListenerSSLConfig" />
    
    <httpEndpoint id="defaultHttpEndpoint"
      host="${listener.host}"
      httpPort="${http.port}"
      httpsPort="${https.port}"
      sslOptionsRef="mySSLOptions"
    />
  • 變更預設 sslOptions 元素來指向預設 SSL 配置以外的 SSL 配置。
    這個選項不會改變 httpEndpoint。 下列範例顯示如何變更預設 sslOptions 元素,它假設您有一個已定義好,且不在這個範例中的 SSL 配置,名稱為 wasListenerSSLConfig:
    <sslOptions id="defaultSSLOptions" sslRef="wasListenerSSLConfig" />