Jump to content

HAP breaks when I use X-Content-Type-Options=nosniff


Recommended Posts

Posted
Just installed HAP but was having an issue getting it to work. Found the culprit in the end, I have X-Content-Type-Options set on my ISS server to stop MIME sniffing, this breaks HAP though (if I remove that header then HAP works just fine - tried on two completely different IIS servers with the same reproducible issue). Any thoughts? Id rather not disable this if possible.
Posted

I used IE11 developer mode to get the web page error message; take the header away and it works again immediately. We are using a real SSL cert, this is a subdomain of a working website (which works with the header).

here are three pictures, working, not working and the web page error working.png not_working.png error.png

Posted

Hmm looks like the HAP+ core javascript file isn't loading.

 

Can you browse to /hap/api/js/hap

 

If that comes up with an error then post that error here.

Posted (edited)

I can browse to that page without any F12 errors. The page looks the same with or without the header (a long string of code)

 

2.png

 

edit: a long shot, does HAP attempt to check MIME types at all? since the whole point of nosniff is to stop MIME sniffing, perhaps that is triggering something? I dropped the URL back to /api - that worked too, I had no idea there were so many api's available. /api/test returns "OK" if that is any help. the others I have tried return an index out of range aspx error.

Edited by KK20
Posted
Hmm really odd. I come back to why force this feature off? I think by doing what you are doing (which in an asp.net application isn't needed) it isn't able to figure out that the hap file being presented is a javascript file. If you must have that header on for other sites, I would recommend having it removed in HAP application
Posted
I have removed the header for this site, not really an amazing issue; the header is just there as a security (good practice) reason. It is cure against mime sniffing attacks that is all. Oh well, thanks for getting back quickly though.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...