Bug #2494
closedforeman proxy returning html instead of JSON
Description
When trying to add a smart proxy in foreman, I get this error:
Unable to save
No features found on this proxy, please make sure you enable at least one feature
here is the output from curl and the production.log file:
curl k -H "Content-Type:application/json" -H "Accept:application/json" https://foremanhost:8443/features//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "
<html>
<head>
<title>DHCP Web interface</title>
<link href='/css/styles.css' rel='stylesheet' />
</head>
<body>
<div id='wrapper'>
<div id='header'>
<h1>DHCP Browser</h1>
<div id='nav'>
<ol>
<a href='/dhcp'> <li>Home</li> </a>
<a href='/features'> <li>Features</li> </a>
</ol>
</div>
</div>
<div id='content'>
<h2>Suported features</h2>
<ul>
<li>puppet</li>
<li>puppetca</li>
<li>tftp</li>
</ul>
</div>
<div id='footer'>
<p> © 2010 <a href='mailto:ohadlevy@gmail.com'> Ohad Levy </a> </p>
</div>
</div>
</body>
</html>
/var/log/foreman/production.log:
Failed to parse response: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>DHCP Web interface</title>
<link href='/css/styles.css' rel='stylesheet' />
</head>
<body>
<div id='wrapper'>
<div id='header'>
<h1>DHCP Browser</h1>
<div id='nav'>
<ol>
<a href='/dhcp'> <li>Home</li> </a>
<a href='/features'> <li>Features</li> </a>
</ol>
</div>
</div>
<div id='content'>
<h2>Suported features</h2>
<ul>
<li>puppet</li>
<li>puppetca</li>
<li>tftp</li>
</ul>
</div>
<div id='footer'>
<p> © 2010 <a href='mailto:ohadlevy@gmail.com'> Ohad Levy </a> </p>
</div>
</div>
</body>
</html>
> 757: unexpected token at '<!DOCTYPE html PUBLIC "//W3C//DTD XHTML
1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>DHCP Web interface</title>
<link href='/css/styles.css' rel='stylesheet' />
</head>
<body>
<div id='wrapper'>
<div id='header'>
<h1>DHCP Browser</h1>
<div id='nav'>
<ol>
<a href='/dhcp'> <li>Home</li> </a>
<a href='/features'> <li>Features</li> </a>
</ol>
</div>
</div>
<div id='content'>
<h2>Suported features</h2>
<ul>
<li>puppet</li>
<li>puppetca</li>
<li>tftp</li>
</ul>
</div>
<div id='footer'>
<p> © 2010 <a href='mailto:ohadlevy@gmail.com'> Ohad Levy </a> </p>
</div>
</div>
</body>
</html>
'
Failed to save: No features found on this proxy, please make sure you enable at least one feature
Updated by Dominic Cleal over 11 years ago
- Project changed from Foreman to Smart Proxy
Updated by Dominic Cleal over 11 years ago
- Category set to API
- Status changed from New to Feedback
This looks like the issue here: https://github.com/theforeman/smart-proxy/pull/73
Which version of Sinatra are you using?
Updated by cristian falcas over 11 years ago
Sorry, I forgot to say the versions. Sinatra is rubygem-sinatra-1.0-2.el6.noarch.
Packages (ruby and foreman) installed (on Oracle Linux Server release 6.4):
foreman-1.1stable-3.el6.noarch
foreman-installer-1.1.2-1.noarch
foreman-proxy-1.1stable-1.el6.noarch
foreman-sqlite-1.1stable-3.el6.noarch
libselinux-ruby-2.0.94-5.3.el6.x86_64
ruby-1.8.7.352-4.el6.x86_64
ruby19-1.9.2p290-1.el6.x86_64
ruby-augeas-0.4.1-1.el6.x86_64
rubygem-abstract-1.0.0-1.el6.noarch
rubygem-actionmailer-3.0.20-1.el6.noarch
rubygem-actionpack-3.0.20-1.el6.noarch
rubygem-activemodel-3.0.20-1.el6.noarch
rubygem-activerecord-3.0.20-1.el6.noarch
rubygem-activeresource-3.0.20-1.el6.noarch
rubygem-activesupport-3.0.20-1.el6.noarch
rubygem-acts_as_audited-2.0.0-1.el6.noarch
rubygem-ancestry-1.3.0-1.el6.noarch
rubygem-apipie-rails-0.0.13-1.el6.noarch
rubygem-arel-2.0.10-1.el6.noarch
rubygem-audited-3.0.0.rc1-1.el6.noarch
rubygem-audited-activerecord-3.0.0.rc1-1.el6.noarch
rubygem-builder-2.1.2-1.el6.noarch
rubygem-bundler-1.0.15-1.el6.noarch
rubygem-erubis-2.6.6-1.el6.noarch
rubygem-fastthread-1.0.7-2.el6.x86_64
rubygem-highline-1.4.0-2.el6.noarch
rubygem-i18n-0.5.0-1.el6.noarch
rubygem-jquery-rails-1.0.19-1.el6.noarch
rubygem-json-1.6.8-1.el6.x86_64
rubygem-mail-2.3.3-2.el6.noarch
rubygem-mime-types-1.18-1.el6.noarch
rubygem-multi_json-1.2.0-1.el6.noarch
rubygem-net-ldap-0.3.1-1.el6.noarch
rubygem-oauth-0.4.7-1.el6.noarch
rubygem-passenger-3.0.17-2.el6.1.x86_64
rubygem-passenger-native-3.0.17-2.el6.1.x86_64
rubygem-passenger-native-libs-3.0.17-2.el6.1.x86_64
rubygem-polyglot-0.3.3-1.el6.noarch
rubygem-rabl-0.7.5-1.el6.noarch
rubygem-rack-1.2.5-4.el6.noarch
rubygem-rack-mount-0.6.14-1.el6.noarch
rubygem-rack-test-0.5.7-2.el6.noarch
rubygem-rails-3.0.20-1.el6.noarch
rubygem-railties-3.0.20-1.el6.noarch
rubygem-rake-0.9.2.2-2.el6.noarch
rubygem-rdoc-3.12-2.el6.x86_64
rubygem-rest-client-1.6.7-1.el6.noarch
rubygem-ruby2ruby-2.0.1-1.el6.noarch
rubygem-ruby_parser-3.0.1-2.el6.noarch
rubygems-1.8.10-1.el6.noarch
rubygem-safemode-1.2.0-1.el6.noarch
rubygem-scoped_search-2.4.0-1.el6.noarch
rubygem-sexp_processor-4.1.2-1.el6.noarch
rubygem-sinatra-1.0-2.el6.noarch
rubygem-sqlite3-1.3.5-2.el6.x86_64
rubygem-thor-0.14.6-2.el6.noarch
rubygem-treetop-1.4.9-1.el6.noarch
rubygem-tzinfo-0.3.32-1.el6.noarch
rubygem-uuidtools-2.1.1-1.el6.noarch
rubygem-will_paginate-3.0.3-1.el6.noarch
ruby-irb-1.8.7.352-4.el6.noarch
ruby-libs-1.8.7.352-4.el6.x86_64
ruby-rdoc-1.8.7.352-4.el6.noarch
ruby-shadow-1.4.1-13.el6.x86_64
Updated by Dominic Cleal over 11 years ago
Can you do a `gem list` too, in case it's been installed that way?
Updated by cristian falcas over 11 years ago
thank you.
I had sinatra-1.4.2 installed manually it seems. I removed the manually installed one and now it works (with sinatra (1.0)).
Updated by Dominic Cleal over 11 years ago
- Status changed from Feedback to Rejected
Thanks for confirming, glad it's sorted!