пн, 1 апр. 2024 г. в 23:54, DAngel <dangel....@gmail.com>:
>
> Hi!
>
>  I am using http 1.1
>
>  The browser connects directly to tomcat (in my environment, I directly
> access localhost:8080/myApp )
>
>  In my development environment I can do the necessary tests (without
> restrictions)
>
>  I can always reproduce the error by simply clearing the browser cache.
>  In the first request the CSS resources do not load correctly, when I
> refresh the page they load correctly.
>
> In the browser console, the error on the first request is:
> refused to apply style from "..." because its mime type 'text/html is not a
> supported styleshee mime type

1. Do you see those requests in an access-log file (if you have an
AccessLogValve configured).

> In the browser console, the error on the first request is:
> refused to apply style from "..." because its mime type 'text/html is not a
> supported styleshee mime type

Content-Type text/html is expected for an error response, but I wonder
why the browser behaves like that. A response with a status code of
400 should be ignored. One should not try to process it as a css file.
Is status code "400" shown in the access log file?

2. I think that as you can reproduce the issue at will, a good way
forward is to try remote debugging.
See
https://cwiki.apache.org/confluence/display/TOMCAT/Troubleshooting+and+Diagnostics#TroubleshootingandDiagnostics-CommonTroubleshootingScenario

3. In general HTTP error 400 means that a client makes a wrong request.
If it is a server-side error, I would expect a 5xx code.

I wonder why a repeated request results in a success.

Is the URL the same? There are no random components in it?
Are headers the same?

If rejection were caused by a request URI validation (and it is more
strict in Tomcat 9 than in an old version of Tomcat 7, configurable on
<Connector>) then there would be no difference whether it is the first
request or a repeated one.

I think that some frameworks (like Spring) use result code 400 when
they cannot find a proper route/handler for the request. Or maybe when
a parameter has an incorrect value (passing text where a number is
expected).

4. It is possible to configure a custom error page for a result code
in the WEB-INF/web.xml file of a web application.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to