Foreman api call redirecting

Hi,

I have used following api call for hostgroup changing purpose in standalone
foreman setup. It worked well.

curl -k -u username:password -H "Accept: version=2,application/json" -H
"Content-Type: application/json" -X PUT -d '{"host":{ "hostgroup_name":
["Free"] }}' http://foremanurl/api/hosts/172.x.x.x

Currently i have moved my setup to HA(Behind load balancer). But now i'm
getting following message. Kindly help me to fix this.

<html><body>You are being <a
href="https://foremanurl/api/hosts/172.x.x.x">redirected</a>.</body></html>

Regards,
Suresh

> Hi,
>
> I have used following api call for hostgroup changing purpose in
> standalone foreman setup. It worked well.
>
> curl -k -u username:password -H "Accept: version=2,application/json" -H
> "Content-Type: application/json" -X PUT -d '{"host":{ "hostgroup_name":
> ["Free"] }}' http://foremanurl/api/hosts/172.x.x.x
>
> Currently i have moved my setup to HA(Behind load balancer). But now
> i'm getting following message. Kindly help me to fix this.
>
> <html><body>You are being <a href="https://foremanurl/api/hosts/172.x.x.x
> ">redirected</a>.</body></html>
>

I assume you should change to https://foremanurl vs http.

Ohad

··· On Thu, Mar 17, 2016 at 9:39 AM, Suresh P wrote:

Regards,
Suresh


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

Hi Ohad,

If i change it to https i'm getting following error.

curl: (35) NSS: client certificate not found (nickname not specified)

Regards,
Suresh

··· On Thursday, 17 March 2016 13:11:49 UTC+5:30, ohad wrote: > > > > On Thu, Mar 17, 2016 at 9:39 AM, Suresh P > wrote: > >> Hi, >> >> I have used following api call for hostgroup changing purpose in >> standalone foreman setup. It worked well. >> >> curl -k -u username:password -H "Accept: version=2,application/json" -H >> "Content-Type: application/json" -X PUT -d '{"host":{ "hostgroup_name": >> ["Free"] }}' http://foremanurl/api/hosts/172.x.x.x >> >> Currently i have moved my setup to HA(Behind load balancer). But now >> i'm getting following message. Kindly help me to fix this. >> >> You are being redirected. >> > > I assume you should change to https://foremanurl vs http. > > Ohad > >> >> Regards, >> Suresh >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Foreman users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to foreman-user...@googlegroups.com . >> To post to this group, send email to forema...@googlegroups.com >> . >> Visit this group at https://groups.google.com/group/foreman-users. >> For more options, visit https://groups.google.com/d/optout. >> > >

Any help!

··· On Thursday, 17 March 2016 13:21:54 UTC+5:30, Suresh P wrote: > > Hi Ohad, > > If i change it to https i'm getting following error. > > curl: (35) NSS: client certificate not found (nickname not specified) > > Regards, > Suresh > > > On Thursday, 17 March 2016 13:11:49 UTC+5:30, ohad wrote: >> >> >> >> On Thu, Mar 17, 2016 at 9:39 AM, Suresh P wrote: >> >>> Hi, >>> >>> I have used following api call for hostgroup changing purpose in >>> standalone foreman setup. It worked well. >>> >>> curl -k -u username:password -H "Accept: version=2,application/json" -H >>> "Content-Type: application/json" -X PUT -d '{"host":{ "hostgroup_name": >>> ["Free"] }}' http://foremanurl/api/hosts/172.x.x.x >>> >>> Currently i have moved my setup to HA(Behind load balancer). But now >>> i'm getting following message. Kindly help me to fix this. >>> >>> You are being redirected. >>> >> >> I assume you should change to https://foremanurl vs http. >> >> Ohad >> >>> >>> Regards, >>> Suresh >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Foreman users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to foreman-user...@googlegroups.com. >>> To post to this group, send email to forema...@googlegroups.com. >>> Visit this group at https://groups.google.com/group/foreman-users. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >>

Getting following error in /var/log/foreman/production.log

> Started GET "/api/domains?page=2" for 172.29.248.108 at 2016-03-22
06:14:30 -0700
2016-03-22 06:14:30 [app] [I] Rendered api/v2/reports/create.json.rabl
(7.6ms)
2016-03-22 06:14:30 [app] [I] Completed 201 Created in 45ms (Views: 7.6ms |
ActiveRecord: 7.9ms)
2016-03-22 06:14:30 [app] [I] Processing by
Api::V2::DomainsController#index as JSON
2016-03-22 06:14:30 [app] [I] Parameters: {"page"=>"2", "apiv"=>"v2"}
2016-03-22 06:14:30 [app] [I] Redirected to
https://us1-foreman.zohonoc.com/api/domains?page=2
2016-03-22 06:14:30 [app] [I] Filter chain halted as
#<Proc:0x000000046a1608/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/force_ssl.rb:28>
rendered or redirected
2016-03-22 06:14:30 [app] [I] Completed 301 Moved Permanently in 1ms
(ActiveRecord: 0.0m

Regards,
Suresh

··· On Monday, 21 March 2016 21:50:58 UTC+5:30, Suresh P wrote: > > > Any help! > > On Thursday, 17 March 2016 13:21:54 UTC+5:30, Suresh P wrote: >> >> Hi Ohad, >> >> If i change it to https i'm getting following error. >> >> curl: (35) NSS: client certificate not found (nickname not specified) >> >> Regards, >> Suresh >> >> >> On Thursday, 17 March 2016 13:11:49 UTC+5:30, ohad wrote: >>> >>> >>> >>> On Thu, Mar 17, 2016 at 9:39 AM, Suresh P wrote: >>> >>>> Hi, >>>> >>>> I have used following api call for hostgroup changing purpose in >>>> standalone foreman setup. It worked well. >>>> >>>> curl -k -u username:password -H "Accept: version=2,application/json" -H >>>> "Content-Type: application/json" -X PUT -d '{"host":{ "hostgroup_name": >>>> ["Free"] }}' http://foremanurl/api/hosts/172.x.x.x >>>> >>>> Currently i have moved my setup to HA(Behind load balancer). But now >>>> i'm getting following message. Kindly help me to fix this. >>>> >>>> You are being redirected. >>>> >>> >>> I assume you should change to https://foremanurl vs http. >>> >>> Ohad >>> >>>> >>>> Regards, >>>> Suresh >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Foreman users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to foreman-user...@googlegroups.com. >>>> To post to this group, send email to forema...@googlegroups.com. >>>> Visit this group at https://groups.google.com/group/foreman-users. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>>

I am getting the same issue, did you find a solution by chance?

··· On Tuesday, March 22, 2016 at 8:16:45 AM UTC-5, Suresh P wrote: > > Getting following error in /var/log/foreman/production.log > > > Started GET "/api/domains?page=2" for 172.29.248.108 at 2016-03-22 > 06:14:30 -0700 > 2016-03-22 06:14:30 [app] [I] Rendered api/v2/reports/create.json.rabl > (7.6ms) > 2016-03-22 06:14:30 [app] [I] Completed 201 Created in 45ms (Views: 7.6ms > > ActiveRecord: 7.9ms) > 2016-03-22 06:14:30 [app] [I] Processing by > Api::V2::DomainsController#index as JSON > 2016-03-22 06:14:30 [app] [I] Parameters: {"page"=>"2", "apiv"=>"v2"} > 2016-03-22 06:14:30 [app] [I] Redirected to > https://us1-foreman.zohonoc.com/api/domains?page=2 > 2016-03-22 06:14:30 [app] [I] Filter chain halted as > # > rendered or redirected > 2016-03-22 06:14:30 [app] [I] Completed 301 Moved Permanently in 1ms > (ActiveRecord: 0.0m > > Regards, > Suresh > > > > On Monday, 21 March 2016 21:50:58 UTC+5:30, Suresh P wrote: >> >> >> Any help! >> >> On Thursday, 17 March 2016 13:21:54 UTC+5:30, Suresh P wrote: >>> >>> Hi Ohad, >>> >>> If i change it to https i'm getting following error. >>> >>> curl: (35) NSS: client certificate not found (nickname not specified) >>> >>> Regards, >>> Suresh >>> >>> >>> On Thursday, 17 March 2016 13:11:49 UTC+5:30, ohad wrote: >>>> >>>> >>>> >>>> On Thu, Mar 17, 2016 at 9:39 AM, Suresh P wrote: >>>> >>>>> Hi, >>>>> >>>>> I have used following api call for hostgroup changing purpose in >>>>> standalone foreman setup. It worked well. >>>>> >>>>> curl -k -u username:password -H "Accept: version=2,application/json" >>>>> -H "Content-Type: application/json" -X PUT -d '{"host":{ "hostgroup_name": >>>>> ["Free"] }}' http://foremanurl/api/hosts/172.x.x.x >>>>> >>>>> Currently i have moved my setup to HA(Behind load balancer). But >>>>> now i'm getting following message. Kindly help me to fix this. >>>>> >>>>> You are being redirected. >>>>> >>>> >>>> I assume you should change to https://foremanurl vs http. >>>> >>>> Ohad >>>> >>>>> >>>>> Regards, >>>>> Suresh >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Foreman users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to foreman-user...@googlegroups.com. >>>>> To post to this group, send email to forema...@googlegroups.com. >>>>> Visit this group at https://groups.google.com/group/foreman-users. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>>

Yes it is due to curl comparability. I have ran the curl command on
centos6.4 os which is not supporting https://foreman-url and latest version
of foreman will not support http.

Right now i'm using the same command with https from centos 7.x os version
which is working perfect.

··· On Fri, Jul 22, 2016 at 9:35 PM, Jeff Sparrow wrote:

I am getting the same issue, did you find a solution by chance?

On Tuesday, March 22, 2016 at 8:16:45 AM UTC-5, Suresh P wrote:

Getting following error in /var/log/foreman/production.log

Started GET “/api/domains?page=2” for 172.29.248.108 at 2016-03-22
06:14:30 -0700
2016-03-22 06:14:30 [app] [I] Rendered api/v2/reports/create.json.rabl
(7.6ms)
2016-03-22 06:14:30 [app] [I] Completed 201 Created in 45ms (Views: 7.6ms
ActiveRecord: 7.9ms)
2016-03-22 06:14:30 [app] [I] Processing by
Api::V2::DomainsController#index as JSON
2016-03-22 06:14:30 [app] [I] Parameters: {“page”=>“2”, “apiv”=>“v2”}
2016-03-22 06:14:30 [app] [I] Redirected to
https://us1-foreman.zohonoc.com/api/domains?page=2
2016-03-22 06:14:30 [app] [I] Filter chain halted as
#Proc:0x000000046a1608/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/force_ssl.rb:28
rendered or redirected
2016-03-22 06:14:30 [app] [I] Completed 301 Moved Permanently in 1ms
(ActiveRecord: 0.0m

Regards,
Suresh

On Monday, 21 March 2016 21:50:58 UTC+5:30, Suresh P wrote:

Any help!

On Thursday, 17 March 2016 13:21:54 UTC+5:30, Suresh P wrote:

Hi Ohad,

If i change it to https i’m getting following error.

curl: (35) NSS: client certificate not found (nickname not specified)

Regards,
Suresh

On Thursday, 17 March 2016 13:11:49 UTC+5:30, ohad wrote:

On Thu, Mar 17, 2016 at 9:39 AM, Suresh P psure...@gmail.com wrote:

Hi,

I have used following api call for hostgroup changing purpose in
standalone foreman setup. It worked well.

curl -k -u username:password -H “Accept: version=2,application/json”
-H “Content-Type: application/json” -X PUT -d ‘{“host”:{ “hostgroup_name”:
[“Free”] }}’ http://foremanurl/api/hosts/172.x.x.x

Currently i have moved my setup to HA(Behind load balancer). But
now i’m getting following message. Kindly help me to fix this.

You are being redirected.

I assume you should change to https://foremanurl vs http.

Ohad

Regards,
Suresh


You received this message because you are subscribed to the Google
Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to foreman-user...@googlegroups.com.
To post to this group, send email to forema...@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/foreman-users/hDYvjh9PLwo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.