You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Darius Cooper <da...@gmail.com> on 2019/01/24 00:43:30 UTC

Swagger not using "host" in v2.23.0

We just upgraded from v.2.21.x to v2.23.0
We are setting "host" in our RestConfiguration

That used to show up correctly in v.2.21 in the /api-docs endpoint
Now, the host shown there is whatever is coming in on the Request to
/api-docs

I'm not sure where to look. Is RestSwaggerServlet still used, under the
covers? If not, what's a good place to look in the code, to see what Camel
is doing when we hit  /api-docs

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Re: Swagger not using "host" in v2.23.0

Posted by Darius Cooper <da...@gmail.com>.
Thanks. I created: https://issues.apache.org/jira/browse/CAMEL-13126

I am not sure what the DEFAULT should be ... old way (ignore X-Forward
headers) or new way (use the headers).

On Fri, Jan 25, 2019 at 6:56 AM Darius Cooper <da...@gmail.com>
wrote:

> The JIRA is:  https://issues.apache.org/jira/browse/CAMEL-12855
>
> This is the diff:
> https://github.com/apache/camel/commit/081474d7256cbbd9f041867e38115a85ab8daf0f#diff-75c2ac7a9a6e268418d14a699b72d60f
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
> <#m_4525378220890730692_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Fri, Jan 25, 2019 at 5:35 AM Claus Ibsen <cl...@gmail.com> wrote:
>
>> Hi
>>
>> Find the JIRA ticket.
>> I think they are related to when using http proxies or something like
>> that.
>>
>> On Fri, Jan 25, 2019 at 2:54 AM Darius Cooper <da...@gmail.com>
>> wrote:
>> >
>> > Thanks. I think I might have found the line. In 23.x, the X-FORWARDED
>> > headers are being checked and used to set host.
>> > Example:
>> >
>> https://github.com/apache/camel/blob/release/2.23.0/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java#L360-L363
>> >
>> > I'm guessing this is over-writing any "hardcoded" host that was
>> provided on
>> > the RestConfiguration.
>> >
>> > Would appreciate your thoughts on how this ought to work.
>> >
>> > On Thu, Jan 24, 2019 at 2:03 PM Claus Ibsen <cl...@gmail.com>
>> wrote:
>> >
>> > > Hi
>> > >
>> > > Ah try to look in the change-log or via git log in camel-java-swagger
>> > > to find the commits for the code changes.
>> > > It sounds as if you want to use a hardcoded hostname you have set in
>> > > the rest configuration instead of any HOST header from the HTTP client
>> > > request.
>> > >
>> > > On Thu, Jan 24, 2019 at 1:43 AM Darius Cooper <dariuscooper@gmail.com
>> >
>> > > wrote:
>> > > >
>> > > > We just upgraded from v.2.21.x to v2.23.0
>> > > > We are setting "host" in our RestConfiguration
>> > > >
>> > > > That used to show up correctly in v.2.21 in the /api-docs endpoint
>> > > > Now, the host shown there is whatever is coming in on the Request to
>> > > > /api-docs
>> > > >
>> > > > I'm not sure where to look. Is RestSwaggerServlet still used, under
>> the
>> > > > covers? If not, what's a good place to look in the code, to see what
>> > > Camel
>> > > > is doing when we hit  /api-docs
>> > > >
>> > > > <
>> > >
>> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon
>> > > >
>> > > > Virus-free.
>> > > > www.avast.com
>> > > > <
>> > >
>> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link
>> > > >
>> > > > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>> > >
>> > >
>> > >
>> > > --
>> > > Claus Ibsen
>> > > -----------------
>> > > http://davsclaus.com @davsclaus
>> > > Camel in Action 2: https://www.manning.com/ibsen2
>> > >
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>

Re: Swagger not using "host" in v2.23.0

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You can log a JIRA for an enhancement to add an option to control
whether these x-forward headers should be applied or not, to have the
old behavior vs the new.

On Fri, Jan 25, 2019 at 1:04 PM Darius Cooper <da...@gmail.com> wrote:
>
> The JIRA is:  https://issues.apache.org/jira/browse/CAMEL-12855
>
> This is the diff:
> https://github.com/apache/camel/commit/081474d7256cbbd9f041867e38115a85ab8daf0f#diff-75c2ac7a9a6e268418d14a699b72d60f
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Fri, Jan 25, 2019 at 5:35 AM Claus Ibsen <cl...@gmail.com> wrote:
>
> > Hi
> >
> > Find the JIRA ticket.
> > I think they are related to when using http proxies or something like that.
> >
> > On Fri, Jan 25, 2019 at 2:54 AM Darius Cooper <da...@gmail.com>
> > wrote:
> > >
> > > Thanks. I think I might have found the line. In 23.x, the X-FORWARDED
> > > headers are being checked and used to set host.
> > > Example:
> > >
> > https://github.com/apache/camel/blob/release/2.23.0/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java#L360-L363
> > >
> > > I'm guessing this is over-writing any "hardcoded" host that was provided
> > on
> > > the RestConfiguration.
> > >
> > > Would appreciate your thoughts on how this ought to work.
> > >
> > > On Thu, Jan 24, 2019 at 2:03 PM Claus Ibsen <cl...@gmail.com>
> > wrote:
> > >
> > > > Hi
> > > >
> > > > Ah try to look in the change-log or via git log in camel-java-swagger
> > > > to find the commits for the code changes.
> > > > It sounds as if you want to use a hardcoded hostname you have set in
> > > > the rest configuration instead of any HOST header from the HTTP client
> > > > request.
> > > >
> > > > On Thu, Jan 24, 2019 at 1:43 AM Darius Cooper <da...@gmail.com>
> > > > wrote:
> > > > >
> > > > > We just upgraded from v.2.21.x to v2.23.0
> > > > > We are setting "host" in our RestConfiguration
> > > > >
> > > > > That used to show up correctly in v.2.21 in the /api-docs endpoint
> > > > > Now, the host shown there is whatever is coming in on the Request to
> > > > > /api-docs
> > > > >
> > > > > I'm not sure where to look. Is RestSwaggerServlet still used, under
> > the
> > > > > covers? If not, what's a good place to look in the code, to see what
> > > > Camel
> > > > > is doing when we hit  /api-docs
> > > > >
> > > > > <
> > > >
> > https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon
> > > > >
> > > > > Virus-free.
> > > > > www.avast.com
> > > > > <
> > > >
> > https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link
> > > > >
> > > > > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> > > >
> > > >
> > > >
> > > > --
> > > > Claus Ibsen
> > > > -----------------
> > > > http://davsclaus.com @davsclaus
> > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > >
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Swagger not using "host" in v2.23.0

Posted by Darius Cooper <da...@gmail.com>.
The JIRA is:  https://issues.apache.org/jira/browse/CAMEL-12855

This is the diff:
https://github.com/apache/camel/commit/081474d7256cbbd9f041867e38115a85ab8daf0f#diff-75c2ac7a9a6e268418d14a699b72d60f

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Fri, Jan 25, 2019 at 5:35 AM Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Find the JIRA ticket.
> I think they are related to when using http proxies or something like that.
>
> On Fri, Jan 25, 2019 at 2:54 AM Darius Cooper <da...@gmail.com>
> wrote:
> >
> > Thanks. I think I might have found the line. In 23.x, the X-FORWARDED
> > headers are being checked and used to set host.
> > Example:
> >
> https://github.com/apache/camel/blob/release/2.23.0/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java#L360-L363
> >
> > I'm guessing this is over-writing any "hardcoded" host that was provided
> on
> > the RestConfiguration.
> >
> > Would appreciate your thoughts on how this ought to work.
> >
> > On Thu, Jan 24, 2019 at 2:03 PM Claus Ibsen <cl...@gmail.com>
> wrote:
> >
> > > Hi
> > >
> > > Ah try to look in the change-log or via git log in camel-java-swagger
> > > to find the commits for the code changes.
> > > It sounds as if you want to use a hardcoded hostname you have set in
> > > the rest configuration instead of any HOST header from the HTTP client
> > > request.
> > >
> > > On Thu, Jan 24, 2019 at 1:43 AM Darius Cooper <da...@gmail.com>
> > > wrote:
> > > >
> > > > We just upgraded from v.2.21.x to v2.23.0
> > > > We are setting "host" in our RestConfiguration
> > > >
> > > > That used to show up correctly in v.2.21 in the /api-docs endpoint
> > > > Now, the host shown there is whatever is coming in on the Request to
> > > > /api-docs
> > > >
> > > > I'm not sure where to look. Is RestSwaggerServlet still used, under
> the
> > > > covers? If not, what's a good place to look in the code, to see what
> > > Camel
> > > > is doing when we hit  /api-docs
> > > >
> > > > <
> > >
> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon
> > > >
> > > > Virus-free.
> > > > www.avast.com
> > > > <
> > >
> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link
> > > >
> > > > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -----------------
> > > http://davsclaus.com @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
> > >
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Re: Swagger not using "host" in v2.23.0

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Find the JIRA ticket.
I think they are related to when using http proxies or something like that.

On Fri, Jan 25, 2019 at 2:54 AM Darius Cooper <da...@gmail.com> wrote:
>
> Thanks. I think I might have found the line. In 23.x, the X-FORWARDED
> headers are being checked and used to set host.
> Example:
> https://github.com/apache/camel/blob/release/2.23.0/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java#L360-L363
>
> I'm guessing this is over-writing any "hardcoded" host that was provided on
> the RestConfiguration.
>
> Would appreciate your thoughts on how this ought to work.
>
> On Thu, Jan 24, 2019 at 2:03 PM Claus Ibsen <cl...@gmail.com> wrote:
>
> > Hi
> >
> > Ah try to look in the change-log or via git log in camel-java-swagger
> > to find the commits for the code changes.
> > It sounds as if you want to use a hardcoded hostname you have set in
> > the rest configuration instead of any HOST header from the HTTP client
> > request.
> >
> > On Thu, Jan 24, 2019 at 1:43 AM Darius Cooper <da...@gmail.com>
> > wrote:
> > >
> > > We just upgraded from v.2.21.x to v2.23.0
> > > We are setting "host" in our RestConfiguration
> > >
> > > That used to show up correctly in v.2.21 in the /api-docs endpoint
> > > Now, the host shown there is whatever is coming in on the Request to
> > > /api-docs
> > >
> > > I'm not sure where to look. Is RestSwaggerServlet still used, under the
> > > covers? If not, what's a good place to look in the code, to see what
> > Camel
> > > is doing when we hit  /api-docs
> > >
> > > <
> > https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon
> > >
> > > Virus-free.
> > > www.avast.com
> > > <
> > https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link
> > >
> > > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Swagger not using "host" in v2.23.0

Posted by Darius Cooper <da...@gmail.com>.
Thanks. I think I might have found the line. In 23.x, the X-FORWARDED
headers are being checked and used to set host.
Example:
https://github.com/apache/camel/blob/release/2.23.0/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java#L360-L363

I'm guessing this is over-writing any "hardcoded" host that was provided on
the RestConfiguration.

Would appreciate your thoughts on how this ought to work.

On Thu, Jan 24, 2019 at 2:03 PM Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Ah try to look in the change-log or via git log in camel-java-swagger
> to find the commits for the code changes.
> It sounds as if you want to use a hardcoded hostname you have set in
> the rest configuration instead of any HOST header from the HTTP client
> request.
>
> On Thu, Jan 24, 2019 at 1:43 AM Darius Cooper <da...@gmail.com>
> wrote:
> >
> > We just upgraded from v.2.21.x to v2.23.0
> > We are setting "host" in our RestConfiguration
> >
> > That used to show up correctly in v.2.21 in the /api-docs endpoint
> > Now, the host shown there is whatever is coming in on the Request to
> > /api-docs
> >
> > I'm not sure where to look. Is RestSwaggerServlet still used, under the
> > covers? If not, what's a good place to look in the code, to see what
> Camel
> > is doing when we hit  /api-docs
> >
> > <
> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon
> >
> > Virus-free.
> > www.avast.com
> > <
> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link
> >
> > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Re: Swagger not using "host" in v2.23.0

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Ah try to look in the change-log or via git log in camel-java-swagger
to find the commits for the code changes.
It sounds as if you want to use a hardcoded hostname you have set in
the rest configuration instead of any HOST header from the HTTP client
request.

On Thu, Jan 24, 2019 at 1:43 AM Darius Cooper <da...@gmail.com> wrote:
>
> We just upgraded from v.2.21.x to v2.23.0
> We are setting "host" in our RestConfiguration
>
> That used to show up correctly in v.2.21 in the /api-docs endpoint
> Now, the host shown there is whatever is coming in on the Request to
> /api-docs
>
> I'm not sure where to look. Is RestSwaggerServlet still used, under the
> covers? If not, what's a good place to look in the code, to see what Camel
> is doing when we hit  /api-docs
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2