metadata service returns Content-Type: text/html

Bug #1243878 reported by Lorin Hochstein
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Sridhar Gaddam
neutron
Fix Released
Medium
Sridhar Gaddam

Bug Description

When making an http request against the OpenStack metadata service, it returns "Content-Type: text/html", despite the returned content being in json format.

For example (using httpie):

$ http get http://169.254.169.254/openstack/latest/meta_data.json
HTTP/1.1 200 OK
Content-Length: 1283
Content-Type: text/html; charset=UTF-8
Date: Wed, 23 Oct 2013 18:55:17 GMT

{"random_seed": ... }

The returned content type should really be something like:

Content-Type: application/json; charset=UTF-8

Version: grizzly

Tags: api metadata
Revision history for this message
Lorin Hochstein (lorinh) wrote :

Note that the EC2 metadata service is also returning the incorrect content type. It is returning text/html instead of text/plain

On OpenStack (grizzly):

$ http get http://169.254.169.254/2009-04-04/meta-data/ami-id
HTTP/1.1 200 OK
Content-Length: 12
Content-Type: text/html; charset=UTF-8
Date: Wed, 23 Oct 2013 19:16:02 GMT

ami-00000005

On Amazon EC2:

$ http get http://169.254.169.254/2009-04-04/meta-data/ami-id
HTTP/1.0 200 OK
Accept-Ranges: bytes
Connection: close
Content-Length: 12
Content-Type: text/plain
Date: Wed, 23 Oct 2013 19:16:12 GMT
ETag: "1713461041"
Last-Modified: Thu, 20 Jun 2013 13:21:54 GMT
Server: EC2ws

ami-852352ec

tags: added: api
Changed in nova:
status: New → Confirmed
importance: Undecided → Low
tags: added: metadata
Changed in nova:
assignee: nobody → Sridhar Gaddam (sridhargaddam)
Changed in nova:
status: Confirmed → In Progress
Changed in neutron:
assignee: nobody → Sridhar Gaddam (sridhargaddam)
Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/75902

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/76112

Changed in neutron:
importance: Undecided → Medium
milestone: none → icehouse-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/75902
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=50da460869661ba63971a17c9c1b514bf22874a2
Submitter: Jenkins
Branch: master

commit 50da460869661ba63971a17c9c1b514bf22874a2
Author: sridhargaddam <email address hidden>
Date: Mon Feb 24 20:51:31 2014 +0530

    Include proper Content-Type in the HTTP response headers

    Neutron namespace proxy handler and metadata agent were not setting the
    Content-Type in its response. Both of them were returning only the response
    data which is obtained from the nova-metadata-service. Since they were returning
    only the response data, the Content-Type returned to the clients has the default
    one which is - "text/html". Ideally this should be set to the data type which is
    present in the HTTP Response. The fix now includes the Content-Type which is
    returned by nova-metadata-service

    Closes-Bug: #1243878
    Change-Id: If68f0b508fbea4ecd1eb0e58d602b5ba6ccbe263

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/76112
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=cae7a46df0db8fe2fad06f5c743807cee948af68
Submitter: Jenkins
Branch: master

commit cae7a46df0db8fe2fad06f5c743807cee948af68
Author: sridhargaddam <email address hidden>
Date: Tue Feb 25 13:20:19 2014 +0530

    Include proper Content-Type in the HTTP Headers

    Nova Metadata Service was not setting the Content-Type
    in the HTTP Response headers. Because of this, clients
    were receiving the default Content-Type which is "text/html".
    The changes done in this patch will include proper Content-Type
    in the HTTP response headers.

    Closes-Bug: #1243878
    Change-Id: Ia65cdf8099c85f63d7f44f93835c606d679a7ab3

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
milestone: icehouse-3 → 2014.1
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.