Content type of file.css returns as text/html. Need it return text/css.

488 views
Skip to first unread message

Jack Briner

unread,
Nov 20, 2020, 4:53:33 PM11/20/20
to WildFly
I had been running WF 11. I just upgraded to 21.0.1. I still have this same problem. When I request a .css file, it returns as text/html and now Chrome refuses to apply it as CSS. It gets the file but does not apply the CSS because the content-type is wrong.

In my searches across the Internet, the closest hint that I have gotten is that it might be a security issue where the file gets returned as text/html for security.

The Chrome console shows: "Resource interpreted as Stylesheet but transferred with MIME type text/html: "https://localhost:8443/esg/style/esg-orange.css?v11.0.0.16".


Is there some way to explicitly set the content-type or to allow the content-type?

Thanks,
Jack


Tomaž Cerar

unread,
Nov 22, 2020, 10:56:18 AM11/22/20
to Jack Briner, WildFly
Do you have some filter / servlet that intercepts / serves such requests?

Static resource serving that is part of WildFly (undertow) does properly serve content type for resources it serves.


--
tomaž

--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/926756eb-0667-4ad5-a89a-25ebb827a12dn%40googlegroups.com.

Jack Briner

unread,
Nov 30, 2020, 11:43:01 AM11/30/20
to WildFly
Thank you for your response.

I'm really at a loss as where to go. I'll give some random facts that might help.

There is nothing in the standalone.xml file that has been customized other than the data source. 

Our code is old, and I don't know much about how jsp works. However, I would not think that  the jsp organization would impact things. However, I could be wrong. The css files are located below the jsp files in a child directory. The war file that contains the jsp and css is delivered as part of an .ear file.

The CSS files deliver as text/html even if the requests comes from an .html file.

Perhaps some of this information may give you an idea of where to direct me to spend my time.

Thanks,
Jack

Jack Briner

unread,
Dec 2, 2020, 12:35:58 PM12/2/20
to WildFly
Well, I learned a bit about my code and filters.

Yes, filters were the culprit. I was able to add some code like:

String path = ((HttpServletRequest) request).getRequestURI();
if (path.contains(".css")) {
    filterChain.doFilter(request,response);
   return;
}


Thank you for pointing out filters. I have never dealt with them before. They were pretty deep down in the stack.
Reply all
Reply to author
Forward
0 new messages