diff --git a/lib/AccountManager/WebRequest.pm b/lib/AccountManager/WebRequest.pm
index ebee8ea865ecfaef04cdb8e57feaac2aa72205cb..5b2a270078bc28c298bf44f2ad4ace5ef43497e3 100644
--- a/lib/AccountManager/WebRequest.pm
+++ b/lib/AccountManager/WebRequest.pm
@@ -164,6 +164,11 @@ sub respond {
 
     binmode(STDOUT, ":utf8");
 
+    print $self->{cgi}->header(
+        -type    => 'text/html',
+        -charset => ''
+    );
+
     unless ($tt2->process($template, $self->{out}, \*STDOUT)) {
         printf "Content-type: text/plain\n\n Error: %s", $tt2->error();
         $self->{logger}->errorf("Web parser error : %s", $tt2->error());
diff --git a/t/account-manager.cgi.t b/t/account-manager.cgi.t
index aba7bd9e921444461164ea17022941ed78899c19..8a75704e31a1798e6eb85f6295fe39227eb6bcfa 100755
--- a/t/account-manager.cgi.t
+++ b/t/account-manager.cgi.t
@@ -23,7 +23,7 @@ subtest start_page => sub {
     diag($out) if $ENV{TEST_DEBUG};
     like(
         $out,
-        qr{^Content-Type: text/html\n\n},
+        qr{^Content-Type: text/html\r\n\r\n},
         'HTTP headers'
     );
     like(
@@ -50,7 +50,7 @@ subtest sp_selection_page => sub {
     diag($out) if $ENV{TEST_DEBUG};
     like(
         $out,
-        qr{^Content-Type: text/html\n\n},
+        qr{^Content-Type: text/html\r\n\r\n},
         'HTTP headers'
     );
     like(
diff --git a/templates/web/index-nobanner.tt2.html b/templates/web/index-nobanner.tt2.html
index 5d42fb6fea98a864e0605ab70276dd8a0a62aa03..8006d7fcb907d843355de8efce05eae435c396e1 100644
--- a/templates/web/index-nobanner.tt2.html
+++ b/templates/web/index-nobanner.tt2.html
@@ -1,6 +1,3 @@
-Content-Type: text/html
-[% IF cookie %]Set-Cookie: [% cookie %][% END %]
-
 <?xml version="1.0" encoding="utf-8" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/x
 html1/DTD/xhtml1-transitional.dtd">
 
diff --git a/templates/web/index.tt2.html b/templates/web/index.tt2.html
index 161613e76b2f9579d0dbbda7de133c98e27b2fc8..53fce369783a19cdf2a2e748df1fc5b242cd3142 100644
--- a/templates/web/index.tt2.html
+++ b/templates/web/index.tt2.html
@@ -1,6 +1,3 @@
-Content-Type: text/html
-[% IF cookie %]Set-Cookie: [% cookie %][% END %]
-
 <?xml version="1.0" encoding="utf-8" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/x
 html1/DTD/xhtml1-transitional.dtd">
 <html xml:lang="[% iso639 = locale.match('^(.)(.)'); iso639.0; iso639.1 %]" xmlns="http://www.w3.org/1999/xhtml">