This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 06c897f  CAMEL-16793: Document how useXForwardHeaders influences the 
API host configuration
06c897f is described below

commit 06c897f8301f043813d24de2e59c43145483f632
Author: James Netherton <[email protected]>
AuthorDate: Tue Sep 7 08:49:44 2021 +0100

    CAMEL-16793: Document how useXForwardHeaders influences the API host 
configuration
---
 .../camel-openapi-java/src/main/docs/openapi-java.adoc | 18 ++++++++++++++++++
 .../camel-swagger-java/src/main/docs/swagger-java.adoc | 18 ++++++++++++++++++
 docs/components/modules/others/pages/openapi-java.adoc | 18 ++++++++++++++++++
 docs/components/modules/others/pages/swagger-java.adoc | 18 ++++++++++++++++++
 4 files changed, 72 insertions(+)

diff --git a/components/camel-openapi-java/src/main/docs/openapi-java.adoc 
b/components/camel-openapi-java/src/main/docs/openapi-java.adoc
index 897cab1..8bae92d 100644
--- a/components/camel-openapi-java/src/main/docs/openapi-java.adoc
+++ b/components/camel-openapi-java/src/main/docs/openapi-java.adoc
@@ -194,6 +194,24 @@ the HTTP Accept header is used to detect if json or yaml 
can be
 accepted. If either both is accepted or none was set as accepted then
 json is returned as the default format.
 
+== useXForwardHeaders and API URL resolution
+
+The OpenApi specification allows you to specify the host, port & path that is 
serving the API. In OpenApi V2 this is done
+via the `host` field and in OpenAPI V3 it is part of the `servers` field.
+
+By default, the value for these fields is determined by `X-Forwarded` headers, 
`X-Forwarded-Host` & `X-Forwarded-Proto`.
+
+This can be overridden by disabling the lookup of `X-Forwarded` headers and by 
specifying your own host, port & scheme on the REST configuration.
+
+[source,java]
+----
+restConfiguration().component("netty-http")
+    .useXForwardHeaders(false)
+    .apiProperty("schemes", "https");
+    .host("localhost")
+    .port(8080);
+----
+
 == Examples
 
 In the Apache Camel distribution we ship the `camel-example-openapi-cdi`
diff --git a/components/camel-swagger-java/src/main/docs/swagger-java.adoc 
b/components/camel-swagger-java/src/main/docs/swagger-java.adoc
index d17fbf4..593c336 100644
--- a/components/camel-swagger-java/src/main/docs/swagger-java.adoc
+++ b/components/camel-swagger-java/src/main/docs/swagger-java.adoc
@@ -194,6 +194,24 @@ the HTTP Accept header is used to detect if json or yaml 
can be
 accepted. If either both is accepted or none was set as accepted then
 json is returned as the default format.
 
+== useXForwardHeaders and API URL resolution
+
+The Swagger specification allows you to specify the host, port & path that is 
serving the API. This is done
+via the `host` field.
+
+By default, the value for these fields is determined by `X-Forwarded` headers, 
`X-Forwarded-Host` & `X-Forwarded-Proto`.
+
+This can be overridden by disabling the lookup of `X-Forwarded` headers and by 
specifying your own host, port & scheme on the REST configuration.
+
+[source,java]
+----
+restConfiguration().component("netty-http")
+    .useXForwardHeaders(false)
+    .apiProperty("schemes", "https");
+    .host("localhost")
+    .port(8080);
+----
+
 == Examples
 
 In the Apache Camel distribution we ship
diff --git a/docs/components/modules/others/pages/openapi-java.adoc 
b/docs/components/modules/others/pages/openapi-java.adoc
index e2c7683..e02dd69 100644
--- a/docs/components/modules/others/pages/openapi-java.adoc
+++ b/docs/components/modules/others/pages/openapi-java.adoc
@@ -196,6 +196,24 @@ the HTTP Accept header is used to detect if json or yaml 
can be
 accepted. If either both is accepted or none was set as accepted then
 json is returned as the default format.
 
+== useXForwardHeaders and API URL resolution
+
+The OpenApi specification allows you to specify the host, port & path that is 
serving the API. In OpenApi V2 this is done
+via the `host` field and in OpenAPI V3 it is part of the `servers` field.
+
+By default, the value for these fields is determined by `X-Forwarded` headers, 
`X-Forwarded-Host` & `X-Forwarded-Proto`.
+
+This can be overridden by disabling the lookup of `X-Forwarded` headers and by 
specifying your own host, port & scheme on the REST configuration.
+
+[source,java]
+----
+restConfiguration().component("netty-http")
+    .useXForwardHeaders(false)
+    .apiProperty("schemes", "https");
+    .host("localhost")
+    .port(8080);
+----
+
 == Examples
 
 In the Apache Camel distribution we ship the `camel-example-openapi-cdi`
diff --git a/docs/components/modules/others/pages/swagger-java.adoc 
b/docs/components/modules/others/pages/swagger-java.adoc
index c2b971b..d966ea2 100644
--- a/docs/components/modules/others/pages/swagger-java.adoc
+++ b/docs/components/modules/others/pages/swagger-java.adoc
@@ -196,6 +196,24 @@ the HTTP Accept header is used to detect if json or yaml 
can be
 accepted. If either both is accepted or none was set as accepted then
 json is returned as the default format.
 
+== useXForwardHeaders and API URL resolution
+
+The Swagger specification allows you to specify the host, port & path that is 
serving the API. This is done
+via the `host` field.
+
+By default, the value for these fields is determined by `X-Forwarded` headers, 
`X-Forwarded-Host` & `X-Forwarded-Proto`.
+
+This can be overridden by disabling the lookup of `X-Forwarded` headers and by 
specifying your own host, port & scheme on the REST configuration.
+
+[source,java]
+----
+restConfiguration().component("netty-http")
+    .useXForwardHeaders(false)
+    .apiProperty("schemes", "https");
+    .host("localhost")
+    .port(8080);
+----
+
 == Examples
 
 In the Apache Camel distribution we ship

Reply via email to