Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing content type #350

Closed
rengert opened this issue Jul 25, 2018 · 5 comments
Closed

Missing content type #350

rengert opened this issue Jul 25, 2018 · 5 comments
Assignees
Milestone

Comments

@rengert
Copy link
Contributor

rengert commented Jul 25, 2018

It seems piranha is not providing content type in response.

In general maybe no big issue, but if you run the application with the following security header:
<add name="X-Content-Type-Options" value="nosniff" />

The browsers (or other applications) are ask to ignore file extensions or guessing using the content.

What is the result or the problem:
You can see it very easily using the sitemap, the sitemap is displayed in the browser as plaintext, not as xml where you can collapse the nodes etc.
Another application i am using for seo analysis thinks the sitemap is a normal page and gave me the advice to add description, headline etc.

I have no idea what the result is for a crawler or so.

So my request is: Please add the content type header depending on the resource (xml for the sitemap ;) )

I did a quick check, the mvc is working correcty, if i request the response from the controller directly i see the correct content type (for example json)
public IActionResult Details() { return Json(""); }

@tidyui
Copy link
Member

tidyui commented Jul 25, 2018

Just to clarify, I assume this error only exists for the Sitemap middleware as everything else is standard MVC?

@rengert
Copy link
Contributor Author

rengert commented Jul 26, 2018

Well, no. I see no content type in the response of the pages served by cms as well. But i see no side effect so far - but i only checked with my browsers (chrome, firefox, ie and mobile browsers safari and chrome on ios) and i dont know, the default behavior of application which implemented the "nosniff".

I checked the manager section and this is fine, the content type is included.

Same maybe for the encoding, i saw it in manager, that it is "gzip" there, should be for content management pages as well?

@rengert
Copy link
Contributor Author

rengert commented Jul 26, 2018

Well, additional comment. I think you can ignore the cms part. The content type is only missing in case of response type "304". I guess this is fine, i checked with other website and there the content type is also included in "304" case. But as i said, i see no error case. So fixing the sitemap.xml would be enough and great.

Sorry for the confusion. Thanks.

@tidyui
Copy link
Member

tidyui commented Jul 26, 2018

I've checked pages coming from the CMS and they return text/html; charset=utf-8 both on localhost and from azure. Like you say, for 304 I don't see any problem with it, but I'll make sure to add application/xml; charset=utf-8 for the sitemap

@tidyui tidyui added this to the Version 5.2 milestone Aug 2, 2018
@tidyui tidyui modified the milestones: Version 5.2, Version 5.1.2 Aug 10, 2018
@tidyui tidyui closed this as completed in 362d5e0 Aug 10, 2018
@tidyui tidyui self-assigned this Aug 10, 2018
@tidyui
Copy link
Member

tidyui commented Aug 10, 2018

This has now been released and is available in Piranha.AspNetCore 5.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants