User Agent string in Content-Type header causing 415

Diana Huang 21 Reputation points

Hi all,

Our codebase uses an sdk that appends the user agent string to the Content-Type of the http request. (Content-Type: application/json-patch+json+libhttp/8.03+(PlayStation+4))

When we make a POST to our IIS service website, we receive a 415 - Unsupported Media Type. If the user agent string is removed from Content-Type, we receive the expected 200 OK.

We have tried working around this by adding a MIME type to the IIS website config. We tried several extensions that should work for basic strings that weren't already being used (.log, .asc) with the value being "libhttp/8.03+(PlayStation+4)". But we still receive 415s.

Is there a known way to handle this? Our IIS version is 8.5.

Internet Information Services
0 comments No comments
{count} votes

Accepted answer
  1. HuryShen - MSFT 321 Reputation points

    In my opinion, I don't think we can solve this problem according to add more items in MIME type of IIS.

    We can add a new "fileExtension" in MIME type and set its "mimeType" to allow IIS recognize this kind of file extension. But we can't add a new "mimeType" to ask IIS recognize this kind of "mimeType". In other words, we can input anything(eg .aa .bb .cc) for the value of "fileExtension", but we can't use a nonexistent type for the value of "mimeType".

       <mimeMap fileExtension="anything(eg .aa .bb .cc)" mimeType="we can just use common MIME types" />  

    The operation "append user-agent to content-type" which you mentioned in your question is strange. I think you'd better set the user-agent in the header of the http request in your code instead of append it to content-type.

    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful