[
https://issues.apache.org/jira/browse/CAMEL-20490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17822058#comment-17822058
]
Karen Lease edited comment on CAMEL-20490 at 2/29/24 10:17 AM:
---------------------------------------------------------------
[~davsclaus] I think it's the same issue reported in CAMEL-19925 which doesn't
include the server host info unless the X-Forwarded-Proto header is present in
the request. The assumption is that the url is then relative (in this case, the
same as) the url of the openapi spec document.
But I agree it is confusing. Maybe the default for useXForwardHeaders should be
false since this only makes sense when using an application server with certain
configurations.
was (Author: klease78):
[~davsclaus] I think it's the same issue reported in CAMEL-19925 which doesn't
include the server host info unless the X-Forwarded-Proto header is present in
the request. The assumption is that the url is then relative (in this case, the
same as) the url of the openapi spec document.
But I agree it is confusing.
> camel-openapi-java - Empty server url due to X-Forward-Headers
> --------------------------------------------------------------
>
> Key: CAMEL-20490
> URL: https://issues.apache.org/jira/browse/CAMEL-20490
> Project: Camel
> Issue Type: Improvement
> Components: camel-rest-openapi
> Reporter: Claus Ibsen
> Priority: Major
> Fix For: 4.x
>
> Attachments: Account.java, rest.camel.yaml
>
>
> This looks a bit mysterious as restConfiguration has
> `useXForwardHeaders=true` as default which causes the url to be empty or just
> the base path (but you can have / as base-path)
> {code}
> {
> "openapi" : "3.0.0",
> "info" : { },
> "servers" : [ {
> "url" : ""
> } ],
> "paths" : {
> "/account" : {
> "get" : {
> "operationId" : "get-c5d3",
> "responses" : {
> "200" : {
> "description" : "Output type",
> "content" : {
> "application/json" : {
> "schema" : {
> "$ref" : "#/components/schemas/Account"
> }
> }
> }
> }
> }
> }
> }
> },
> "components" : {
> "schemas" : {
> "Account" : {
> "type" : "object",
> "properties" : {
> "accountNumber" : {
> "type" : "string"
> },
> "accountName" : {
> "type" : "string"
> },
> "balance" : {
> "type" : "number",
> "format" : "double"
> }
> }
> }
> }
> }
> }
> {code}
> Notice how the server urls is "" (empty).
> But the server url has been computed to http://0.0.0.0:8080 by default prior
> to setupXForwardedHeaders is invoked.
> I am not sure why this line is as-is
> https://github.com/apache/camel/blob/f234dae17fa1c6090e13ffd898c8287bf149b57f/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiSupport.java#L136
--
This message was sent by Atlassian Jira
(v8.20.10#820010)