Better fix for the duplicate Date header.

This commit is contained in:
Simone Bordet 2014-05-04 15:27:09 +02:00
parent 93324644b2
commit 4369e1d242
1 changed files with 5 additions and 1 deletions

View File

@ -534,6 +534,10 @@ public class ProxyServlet extends HttpServlet
protected void onResponseHeaders(HttpServletRequest request, HttpServletResponse response, Response proxyResponse)
{
// Clear the response headers in case it comes with predefined ones.
for (String name : response.getHeaderNames())
response.setHeader(name, null);
for (HttpField field : proxyResponse.getHeaders())
{
String headerName = field.getName();
@ -545,7 +549,7 @@ public class ProxyServlet extends HttpServlet
if (newHeaderValue == null || newHeaderValue.trim().length() == 0)
continue;
response.setHeader(headerName, newHeaderValue);
response.addHeader(headerName, newHeaderValue);
}
}