Content-Type missing on template pages, .net 2.1.4, behind nginx

I just setup an Ubuntu VM with .net 2.1.4, cloned the WebAppStarter repo, put it behind nginx, and the web template pages render without a Content-Type (so they display as plain/text).

Wondering if this is a new feature in .net 2.1.4 (which I figured would be backward compatible to 2.0) …

The /metadata, /types, /metadata/debug all display fine as html …

There’s the added X-Content-Type-Options:nosniff header which could be why it’s not able to figure out that it’s text/html and adding default_type "text/html"; to the nginx conf file doesn’t do anything. I don’t see where that X-Content-Type-Options header is being added; although, it does seem to be a nice thing to have. Wondering your thoughts on this.

There’s some info about adding X-Content-Type-Options in .NET Core:

It’s not being added in ServiceStack although I’m not seeing it in .NET Core local http server either so it could be added by nginx. You could check this by comparing the .NET Core host running on the local port vs through nginx.

Anyway the ContentType should now be explicitly set from this commit.

This change is available from v5.0.3 that’s now available on MyGet.

2 Likes

my guess is it’s nginx … but thanks for adding that … can continue to try to get that nice A score with that commit on: https://securityheaders.io :slight_smile:

1 Like