Problems with Katello Bastion UI when changing Foreman base URL

Hey all,

I am having a setup where I use Foreman as a complete backend service.
Another service works on the document root of the HTTPD server. In order to
have all pages of Foreman still reachable, I tried altering the base URL of
Foreman by changing the value for the foreman_url in the foreman-installer.
This is working great so far, all pages of Foreman now changed to
https://<hostname>/foreman, all API calls are working fine.

However, when I try to visit a Katello page like content views or products,
the page cannot load and it ends up in an endless loop. I can provide more
detailed logging output if required, but as far as I can see, there is not
much information that can be found in the logs.

Did anyone ever try changing the base URL and ran into this issue? Is there
a possibility to configure Katello such that the pages work with an altered
base? Is there maybe a setting in the foreman-installer that I need to
change to make it work?

Thanks for reading and all the best,

–Gerrit

https://github.com/Katello/puppet-katello/pull/211 was merged just last
week so I'm guessing few people do. There may be other dragons hiding
because deployment_url is considered relative in post_sync_url now but
in candlepin it might have been considered absolute so I dug in deeper
(as I should have when I merged 211) and it looks like the whole
deployment_url is unused in puppet-candlepin and we should just remove
that part. https://github.com/Katello/puppet-candlepin/pull/82 together
with https://github.com/Katello/puppet-katello/pull/214 should take care
of that.

Looking through the source then I see some examples that should work but
many that do not. What should work is using the foreman_url helper like

What doesn't work is plain URLs like

In short: I think you're entering uncharted/unsupported territory.

··· On Tue, Sep 12, 2017 at 02:56:06AM -0700, gerrit.schwerthelm@avid.com wrote: >I am having a setup where I use Foreman as a complete backend service. >Another service works on the document root of the HTTPD server. In order to >have all pages of Foreman still reachable, I tried altering the base URL of >Foreman by changing the value for the foreman_url in the foreman-installer. >This is working great so far, all pages of Foreman now changed to >https:///foreman, all API calls are working fine. > >However, when I try to visit a Katello page like content views or products, >the page cannot load and it ends up in an endless loop. I can provide more >detailed logging output if required, but as far as I can see, there is not >much information that can be found in the logs. > >Did anyone ever try changing the base URL and ran into this issue? Is there >a possibility to configure Katello such that the pages work with an altered >base? Is there maybe a setting in the foreman-installer that I need to >change to make it work? > >Thanks for reading and all the best,

Hello Ewoud,

thanks for your informative and quick answer. As it looks to me that the
required changes are touching quite a lot of sensitive points (from which
many are not yet identified?), I think it's better for me not to continue
with my undertaking and not to touch the sources.

For now, I will the just redirect ^/$ with httpd to point to an alias of
where my own service sits. This way, only the dashboard of Foreman cannot
be reached anymore, but the rest of Foreman and Katello is still intact and
seems to work for everything I need.

I also already tried running Foreman in production on non-default ports,
but it seems like this is even causing more issues as there seem to be some
hard coded ports for the communication with Pulp in the sources (like
https://github.com/Katello/katello/blob/6aca54157e579d6312a9e4a49609df0ffa1685b1/app/services/katello/proxy_status/pulp.rb#L45).

If you have any other ideas I could try out, I would be very grateful if
you share them with me.

Many thanks and regards,

–Gerrit

··· On Tuesday, September 12, 2017 at 12:29:05 PM UTC+2, Ewoud Kohl van Wijngaarden wrote: > > On Tue, Sep 12, 2017 at 02:56:06AM -0700, gerrit.sc...@avid.com > wrote: > >I am having a setup where I use Foreman as a complete backend service. > >Another service works on the document root of the HTTPD server. In order > to > >have all pages of Foreman still reachable, I tried altering the base URL > of > >Foreman by changing the value for the foreman_url in the > foreman-installer. > >This is working great so far, all pages of Foreman now changed to > >https:///foreman, all API calls are working fine. > > > >However, when I try to visit a Katello page like content views or > products, > >the page cannot load and it ends up in an endless loop. I can provide > more > >detailed logging output if required, but as far as I can see, there is > not > >much information that can be found in the logs. > > > >Did anyone ever try changing the base URL and ran into this issue? Is > there > >a possibility to configure Katello such that the pages work with an > altered > >base? Is there maybe a setting in the foreman-installer that I need to > >change to make it work? > > > >Thanks for reading and all the best, > > https://github.com/Katello/puppet-katello/pull/211 was merged just last > week so I'm guessing few people do. There may be other dragons hiding > because deployment_url is considered relative in post_sync_url now but > in candlepin it might have been considered absolute so I dug in deeper > (as I should have when I merged 211) and it looks like the whole > deployment_url is unused in puppet-candlepin and we should just remove > that part. https://github.com/Katello/puppet-candlepin/pull/82 together > with https://github.com/Katello/puppet-katello/pull/214 should take care > of that. > > Looking through the source then I see some examples that should work but > many that do not. What should work is using the foreman_url helper like > > https://github.com/Katello/katello/blob/b02526bea7026560b2d6d66fac9038cfeb74bab9/app/assets/javascripts/katello/hosts/activation_key_edit.js#L22 > > What doesn't work is plain URLs like > > https://github.com/Katello/katello/blob/b02526bea7026560b2d6d66fac9038cfeb74bab9/app/assets/javascripts/katello/hosts/host_and_hostgroup_edit.js#L28 > > In short: I think you're entering uncharted/unsupported territory. >

Hello Gerrit,

You're right that a lot assumes a static location. Katello has much more
assumptions in this area than vanilla Foreman and while there is an
effort to at least be able to split services onto different hosts where
we might tackle some assumptions in the process there is a long way to
go.

For now I'd advise you to use a separate vhost and use DNS, separate
IP and/or port for your own application because it sounds like that's
more relocatable.

··· On Tue, Sep 12, 2017 at 05:07:13AM -0700, gerrit.schwerthelm@avid.com wrote: >Hello Ewoud, > >thanks for your informative and quick answer. As it looks to me that the >required changes are touching quite a lot of sensitive points (from which >many are not yet identified?), I think it's better for me not to continue >with my undertaking and not to touch the sources. > >For now, I will the just redirect ^/$ with httpd to point to an alias of >where my own service sits. This way, only the dashboard of Foreman cannot >be reached anymore, but the rest of Foreman and Katello is still intact and >seems to work for everything I need. > >I also already tried running Foreman in production on non-default ports, >but it seems like this is even causing more issues as there seem to be some >hard coded ports for the communication with Pulp in the sources (like >https://github.com/Katello/katello/blob/6aca54157e579d6312a9e4a49609df0ffa1685b1/app/services/katello/proxy_status/pulp.rb#L45). > >If you have any other ideas I could try out, I would be very grateful if >you share them with me. > >Many thanks and regards, > >--Gerrit > > >On Tuesday, September 12, 2017 at 12:29:05 PM UTC+2, Ewoud Kohl van >Wijngaarden wrote: >> >> On Tue, Sep 12, 2017 at 02:56:06AM -0700, gerrit.sc...@avid.com >> wrote: >> >I am having a setup where I use Foreman as a complete backend service. >> >Another service works on the document root of the HTTPD server. In order >> to >> >have all pages of Foreman still reachable, I tried altering the base URL >> of >> >Foreman by changing the value for the foreman_url in the >> foreman-installer. >> >This is working great so far, all pages of Foreman now changed to >> >https:///foreman, all API calls are working fine. >> > >> >However, when I try to visit a Katello page like content views or >> products, >> >the page cannot load and it ends up in an endless loop. I can provide >> more >> >detailed logging output if required, but as far as I can see, there is >> not >> >much information that can be found in the logs. >> > >> >Did anyone ever try changing the base URL and ran into this issue? Is >> there >> >a possibility to configure Katello such that the pages work with an >> altered >> >base? Is there maybe a setting in the foreman-installer that I need to >> >change to make it work? >> > >> >Thanks for reading and all the best, >> >> https://github.com/Katello/puppet-katello/pull/211 was merged just last >> week so I'm guessing few people do. There may be other dragons hiding >> because deployment_url is considered relative in post_sync_url now but >> in candlepin it might have been considered absolute so I dug in deeper >> (as I should have when I merged 211) and it looks like the whole >> deployment_url is unused in puppet-candlepin and we should just remove >> that part. https://github.com/Katello/puppet-candlepin/pull/82 together >> with https://github.com/Katello/puppet-katello/pull/214 should take care >> of that. >> >> Looking through the source then I see some examples that should work but >> many that do not. What should work is using the foreman_url helper like >> >> https://github.com/Katello/katello/blob/b02526bea7026560b2d6d66fac9038cfeb74bab9/app/assets/javascripts/katello/hosts/activation_key_edit.js#L22 >> >> What doesn't work is plain URLs like >> >> https://github.com/Katello/katello/blob/b02526bea7026560b2d6d66fac9038cfeb74bab9/app/assets/javascripts/katello/hosts/host_and_hostgroup_edit.js#L28 >> >> In short: I think you're entering uncharted/unsupported territory. >> > >-- >You received this message because you are subscribed to the Google Groups "foreman-dev" group. >To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com. >For more options, visit https://groups.google.com/d/optout.

See also issue #20313 [1] which has an open PR [2].

Cheers,
Walden

[1] Bug #20313: Katello can't use relocated URI - Katello - Foreman
[2] https://github.com/Katello/bastion/pull/206

··· On Tue, Sep 12, 2017 at 8:18 AM, Ewoud Kohl van Wijngaarden < ewoud@kohlvanwijngaarden.nl> wrote:

Hello Gerrit,

You’re right that a lot assumes a static location. Katello has much more
assumptions in this area than vanilla Foreman and while there is an effort
to at least be able to split services onto different hosts where we might
tackle some assumptions in the process there is a long way to go.

For now I’d advise you to use a separate vhost and use DNS, separate IP
and/or port for your own application because it sounds like that’s more
relocatable.

On Tue, Sep 12, 2017 at 05:07:13AM -0700, gerrit.schwerthelm@avid.com > wrote:

Hello Ewoud,

thanks for your informative and quick answer. As it looks to me that the
required changes are touching quite a lot of sensitive points (from which
many are not yet identified?), I think it’s better for me not to continue
with my undertaking and not to touch the sources.

For now, I will the just redirect ^/$ with httpd to point to an alias of
where my own service sits. This way, only the dashboard of Foreman cannot
be reached anymore, but the rest of Foreman and Katello is still intact
and
seems to work for everything I need.

I also already tried running Foreman in production on non-default ports,
but it seems like this is even causing more issues as there seem to be
some
hard coded ports for the communication with Pulp in the sources (like
https://github.com/Katello/katello/blob/6aca54157e579d6312a9
e4a49609df0ffa1685b1/app/services/katello/proxy_status/pulp.rb#L45).

If you have any other ideas I could try out, I would be very grateful if
you share them with me.

Many thanks and regards,

–Gerrit

On Tuesday, September 12, 2017 at 12:29:05 PM UTC+2, Ewoud Kohl van >> Wijngaarden wrote:

On Tue, Sep 12, 2017 at 02:56:06AM -0700, gerrit.sc...@avid.com >>> <javascript:> wrote:

I am having a setup where I use Foreman as a complete backend service.
Another service works on the document root of the HTTPD server. In order
to
have all pages of Foreman still reachable, I tried altering the base URL
of
Foreman by changing the value for the foreman_url in the
foreman-installer.
This is working great so far, all pages of Foreman now changed to
https:///foreman, all API calls are working fine.

However, when I try to visit a Katello page like content views or
products,
the page cannot load and it ends up in an endless loop. I can provide
more
detailed logging output if required, but as far as I can see, there is
not
much information that can be found in the logs.

Did anyone ever try changing the base URL and ran into this issue? Is
there
a possibility to configure Katello such that the pages work with an
altered
base? Is there maybe a setting in the foreman-installer that I need to
change to make it work?

Thanks for reading and all the best,

https://github.com/Katello/puppet-katello/pull/211 was merged just last
week so I’m guessing few people do. There may be other dragons hiding
because deployment_url is considered relative in post_sync_url now but
in candlepin it might have been considered absolute so I dug in deeper
(as I should have when I merged 211) and it looks like the whole
deployment_url is unused in puppet-candlepin and we should just remove
that part. https://github.com/Katello/puppet-candlepin/pull/82 together
with https://github.com/Katello/puppet-katello/pull/214 should take care
of that.

Looking through the source then I see some examples that should work but
many that do not. What should work is using the foreman_url helper like

https://github.com/Katello/katello/blob/b02526bea7026560b2d6
d66fac9038cfeb74bab9/app/assets/javascripts/katello/
hosts/activation_key_edit.js#L22

What doesn’t work is plain URLs like

https://github.com/Katello/katello/blob/b02526bea7026560b2d6
d66fac9038cfeb74bab9/app/assets/javascripts/katello/
hosts/host_and_hostgroup_edit.js#L28

In short: I think you’re entering uncharted/unsupported territory.


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

That's good to know. Added a comment about the JQuery ajax calls.

··· On Tue, Sep 12, 2017 at 09:57:43AM -0400, Walden Raines wrote: >See also issue #20313 [1] which has an open PR [2]. > >Cheers, >Walden > >[1] http://projects.theforeman.org/issues/20313 >[2] https://github.com/Katello/bastion/pull/206 > >On Tue, Sep 12, 2017 at 8:18 AM, Ewoud Kohl van Wijngaarden < >ewoud@kohlvanwijngaarden.nl> wrote: > >> Hello Gerrit, >> >> You're right that a lot assumes a static location. Katello has much more >> assumptions in this area than vanilla Foreman and while there is an effort >> to at least be able to split services onto different hosts where we might >> tackle some assumptions in the process there is a long way to go. >> >> For now I'd advise you to use a separate vhost and use DNS, separate IP >> and/or port for your own application because it sounds like that's more >> relocatable. >> >> On Tue, Sep 12, 2017 at 05:07:13AM -0700, gerrit.schwerthelm@avid.com >> wrote: >> >>> Hello Ewoud, >>> >>> thanks for your informative and quick answer. As it looks to me that the >>> required changes are touching quite a lot of sensitive points (from which >>> many are not yet identified?), I think it's better for me not to continue >>> with my undertaking and not to touch the sources. >>> >>> For now, I will the just redirect ^/$ with httpd to point to an alias of >>> where my own service sits. This way, only the dashboard of Foreman cannot >>> be reached anymore, but the rest of Foreman and Katello is still intact >>> and >>> seems to work for everything I need. >>> >>> I also already tried running Foreman in production on non-default ports, >>> but it seems like this is even causing more issues as there seem to be >>> some >>> hard coded ports for the communication with Pulp in the sources (like >>> https://github.com/Katello/katello/blob/6aca54157e579d6312a9 >>> e4a49609df0ffa1685b1/app/services/katello/proxy_status/pulp.rb#L45). >>> >>> If you have any other ideas I could try out, I would be very grateful if >>> you share them with me. >>> >>> Many thanks and regards, >>> >>> --Gerrit >>> >>> >>> On Tuesday, September 12, 2017 at 12:29:05 PM UTC+2, Ewoud Kohl van >>> Wijngaarden wrote: >>> >>>> >>>> On Tue, Sep 12, 2017 at 02:56:06AM -0700, gerrit.sc...@avid.com >>>> wrote: >>>> >I am having a setup where I use Foreman as a complete backend service. >>>> >Another service works on the document root of the HTTPD server. In order >>>> to >>>> >have all pages of Foreman still reachable, I tried altering the base URL >>>> of >>>> >Foreman by changing the value for the foreman_url in the >>>> foreman-installer. >>>> >This is working great so far, all pages of Foreman now changed to >>>> >https:///foreman, all API calls are working fine. >>>> > >>>> >However, when I try to visit a Katello page like content views or >>>> products, >>>> >the page cannot load and it ends up in an endless loop. I can provide >>>> more >>>> >detailed logging output if required, but as far as I can see, there is >>>> not >>>> >much information that can be found in the logs. >>>> > >>>> >Did anyone ever try changing the base URL and ran into this issue? Is >>>> there >>>> >a possibility to configure Katello such that the pages work with an >>>> altered >>>> >base? Is there maybe a setting in the foreman-installer that I need to >>>> >change to make it work? >>>> > >>>> >Thanks for reading and all the best, >>>> >>>> https://github.com/Katello/puppet-katello/pull/211 was merged just last >>>> week so I'm guessing few people do. There may be other dragons hiding >>>> because deployment_url is considered relative in post_sync_url now but >>>> in candlepin it might have been considered absolute so I dug in deeper >>>> (as I should have when I merged 211) and it looks like the whole >>>> deployment_url is unused in puppet-candlepin and we should just remove >>>> that part. https://github.com/Katello/puppet-candlepin/pull/82 together >>>> with https://github.com/Katello/puppet-katello/pull/214 should take care >>>> of that. >>>> >>>> Looking through the source then I see some examples that should work but >>>> many that do not. What should work is using the foreman_url helper like >>>> >>>> https://github.com/Katello/katello/blob/b02526bea7026560b2d6 >>>> d66fac9038cfeb74bab9/app/assets/javascripts/katello/ >>>> hosts/activation_key_edit.js#L22 >>>> >>>> What doesn't work is plain URLs like >>>> >>>> https://github.com/Katello/katello/blob/b02526bea7026560b2d6 >>>> d66fac9038cfeb74bab9/app/assets/javascripts/katello/ >>>> hosts/host_and_hostgroup_edit.js#L28 >>>> >>>> In short: I think you're entering uncharted/unsupported territory. >>>> >>>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "foreman-dev" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to foreman-dev+unsubscribe@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "foreman-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to foreman-dev+unsubscribe@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > >-- >You received this message because you are subscribed to the Google Groups "foreman-dev" group. >To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com. >For more options, visit https://groups.google.com/d/optout.