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