You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Eric Woods <wo...@gmail.com> on 2011/01/12 20:31:22 UTC

Server returns JSON, not HTML

Hey guys,

I'm trying to access the Deltacloud's HTML front-end for the mock & EC2 drivers.  After starting the server and pointing my browser to http://localhost:3001/api, the server only returns the JSON API, not HTML.  I'm currently running on Mac OSX.  Interestingly, when I installed Deltacloud on a Windows 7 machine this morning, HTML was served as expected.  Any ideas what could cause this?

Thanks,
Eric W.

Re: Server returns JSON, not HTML

Posted by David Lutterkort <lu...@redhat.com>.
On Thu, 2011-01-13 at 09:48 -0500, Eric Woods wrote:
> I'm running Firefox on both the Windows and the Mac machines.  Michal is right, forcing HTML via ?format=html in the URL does the trick.  It would be odd if two instances of Firefox formed the request differently.  It could be related to Firefox tooling I have installed on the mac.
> 
> I don't have access to the Windows machine atm, but Firebug on the Mac indicates the following Accept header is used (with or without ?format=html appended to the URL):
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,application/json
> 
> Since text/html is always given priority in the request header, it looks like the server takes extra steps to handle the URL parameter correctly.  Thanks for your help.

The problem is with your accept header: it says that you'd like
text/html, application/xhtml+xml, and application/json the best - which
one of these is the server's choice [1].

My FF (3.6.13) uses the same Accept header, but without the
application/json.

David

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html if you want to
    get into the gory details



Re: Server returns JSON, not HTML

Posted by Eric Woods <wo...@gmail.com>.
I'm running Firefox on both the Windows and the Mac machines.  Michal is right, forcing HTML via ?format=html in the URL does the trick.  It would be odd if two instances of Firefox formed the request differently.  It could be related to Firefox tooling I have installed on the mac.

I don't have access to the Windows machine atm, but Firebug on the Mac indicates the following Accept header is used (with or without ?format=html appended to the URL):
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,application/json

Since text/html is always given priority in the request header, it looks like the server takes extra steps to handle the URL parameter correctly.  Thanks for your help.

- Eric W.

On Jan 13, 2011, at 4:57 AM, Michal Fojtik wrote:

> On 12/01/11 15:35 -0800, David Lutterkort wrote:
>> On Wed, 2011-01-12 at 14:31 -0500, Eric Woods wrote:
>>> I'm trying to access the Deltacloud's HTML front-end for the mock &
>>> EC2 drivers.  After starting the server and pointing my browser to
>>> http://localhost:3001/api, the server only returns the JSON API, not
>>> HTML.  I'm currently running on Mac OSX.  Interestingly, when I
>>> installed Deltacloud on a Windows 7 machine this morning, HTML was
>>> served as expected.  Any ideas what could cause this?
>> 
>> Is this with Safari ? I remember darkly that webkit has a rather
>> interesting choice for its default Accept header, which makes it not all
>> that useful for content negotiation[1]
> 
> Well we tested it right now using Safari 5 on MacOSX and it returns HTML.
> Could you please debug it more for us ?
> 
>  -- Michal
> 
>> 
>> You can force that HTML be sent back by appending '?format=html' to each
>> URL. Not sure if there's a way to fix the Safari Accept header to
>> something sensible.
>> 
>> David
>> 
>> [1] http://www.gethifi.com/blog/webkit-team-admits-accept-header-error has the
>>   gory details. Also see https://bugs.webkit.org/show_bug.cgi?id=27267
>> 
>> 
> 
> -- 
> --------------------------------------------------------
> Michal Fojtik, mfojtik@redhat.com
> Deltacloud API: http://deltacloud.org
> --------------------------------------------------------


Re: Server returns JSON, not HTML

Posted by Michal Fojtik <mf...@redhat.com>.
On 12/01/11 15:35 -0800, David Lutterkort wrote:
>On Wed, 2011-01-12 at 14:31 -0500, Eric Woods wrote:
>> I'm trying to access the Deltacloud's HTML front-end for the mock &
>> EC2 drivers.  After starting the server and pointing my browser to
>> http://localhost:3001/api, the server only returns the JSON API, not
>> HTML.  I'm currently running on Mac OSX.  Interestingly, when I
>> installed Deltacloud on a Windows 7 machine this morning, HTML was
>> served as expected.  Any ideas what could cause this?
>
>Is this with Safari ? I remember darkly that webkit has a rather
>interesting choice for its default Accept header, which makes it not all
>that useful for content negotiation[1]

Well we tested it right now using Safari 5 on MacOSX and it returns HTML.
Could you please debug it more for us ?

   -- Michal

>
>You can force that HTML be sent back by appending '?format=html' to each
>URL. Not sure if there's a way to fix the Safari Accept header to
>something sensible.
>
>David
>
>[1] http://www.gethifi.com/blog/webkit-team-admits-accept-header-error has the
>    gory details. Also see https://bugs.webkit.org/show_bug.cgi?id=27267
>
>

-- 
--------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org
--------------------------------------------------------

Re: Server returns JSON, not HTML

Posted by David Lutterkort <lu...@redhat.com>.
On Wed, 2011-01-12 at 14:31 -0500, Eric Woods wrote:
> I'm trying to access the Deltacloud's HTML front-end for the mock &
> EC2 drivers.  After starting the server and pointing my browser to
> http://localhost:3001/api, the server only returns the JSON API, not
> HTML.  I'm currently running on Mac OSX.  Interestingly, when I
> installed Deltacloud on a Windows 7 machine this morning, HTML was
> served as expected.  Any ideas what could cause this?

Is this with Safari ? I remember darkly that webkit has a rather
interesting choice for its default Accept header, which makes it not all
that useful for content negotiation[1]

You can force that HTML be sent back by appending '?format=html' to each
URL. Not sure if there's a way to fix the Safari Accept header to
something sensible.

David

[1] http://www.gethifi.com/blog/webkit-team-admits-accept-header-error has the
    gory details. Also see https://bugs.webkit.org/show_bug.cgi?id=27267