Answer the question
In order to leave comments, you need to log in
Is it possible to change tomcat's 401 response?
You need to add some headers to the 401 error. Is it possible to do this somehow?
Tried with filter:
<filter>
<filter-name>Filter</filter-name>
<filter-class>com.example.filter.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Answer the question
In order to leave comments, you need to log in
If I understand correctly, then in web.xml add
<error-page>
<error-code>401</error-code>
<location>/errors/401.jsp</location>
</error-page>
response.addHeader("WWW-Authenticate", "BASIC realm=\"YOUR-REALM\"");
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question