Jump to content

Aborted: Error Parsing Headers: Duplicate Header 'content-Type'


hadzo

Recommended Posts

I have Blesta 3.2 running on php-fpm and whe I want vo view an invoice I get this

ERROR 500 - Internal Server Error!

 

The logs say:

 

FastCGI: comm with server "/var/www/xxxx/xxxx/xxxxx/cgi-bin/php5-fcgi-xxxxxxxxxx" aborted: error parsing headers: duplicate header 'Content-Type'
 

Link to comment
Share on other sites

I have Blesta 3.2 running on php-fpm and whe I want vo view an invoice I get this

ERROR 500 - Internal Server Error!

 

The logs say:

 

FastCGI: comm with server "/var/www/xxxx/xxxx/xxxxx/cgi-bin/php5-fcgi-xxxxxxxxxx" aborted: error parsing headers: duplicate header 'Content-Type'

 

 

Its a knowing problem by php-fpm/fcgi and TCPDF, and they dont provide solutions yet: http://www.fastcgi.com/archives/fastcgi-developers/2008-September/000048.html

 

Also blesta DEV's can read this to see the problem

 

The solution is for Blesta change the code for opening the PDF in a new window and not openning in the same window where the bçesta default header is called, because fcgi detect two headers, the header from blesta and after that the header from TCPDF and cause the error.

Link to comment
Share on other sites

Its a knowing problem by php-fpm/fcgi and TCPDF, and they dont provide solutions yet: http://www.fastcgi.com/archives/fastcgi-developers/2008-September/000048.html

 

Also blesta DEV's can read this to see the problem

 

The solution is for Blesta change the code for opening the PDF in a new window and not openning in the same window where the bçesta default header is called, because fcgi detect two headers, the header from blesta and after that the header from TCPDF and cause the error.

 

Blesta doesn't output headers for invoice downloads. All invoice templates must implement the InvoiceTemplate interface and send all headers themselves. This is how the default and quickbooks invoice templates that ship with Blesta work (they use TCPDF::Output() with 'D' parameter to force download).

 

I've also analyzed the headers and only one "Content-Type" header is sent.

 

post-2-0-20061200-1400607443_thumb.png

Link to comment
Share on other sites

Blesta doesn't output headers for invoice downloads. All invoice templates must implement the InvoiceTemplate interface and send all headers themselves. This is how the default and quickbooks invoice templates that ship with Blesta work (they use TCPDF::Output() with 'D' parameter to force download).

 

I've also analyzed the headers and only one "Content-Type" header is sent.

 

attachicon.gifpdf_headers.png

 

 

Very strange then, how the hell php-fpm reports doble headers? :P

 

I dont have in any server php-fpm but I will install a dev enviorment in our local Hyper-V server a virtual CentOS/Apache/php-fpm to trie to trace it :)

Link to comment
Share on other sites

I have Blesta 3.2 running on php-fpm and whe I want vo view an invoice I get this

ERROR 500 - Internal Server Error!

 

The logs say:

 

FastCGI: comm with server "/var/www/xxxx/xxxx/xxxxx/cgi-bin/php5-fcgi-xxxxxxxxxx" aborted: error parsing headers: duplicate header 'Content-Type'

 

 

My guess is you have some configuration setting on your webserver to set a default content-type header for each request. It probably does this for resources without recognizable extensions that it can translate to mimetypes. If you analyzed the headers I bet you see something like:

 

content-type: "text/html"

...

Content-Type: "application/pdf"

 

The first header being sent by your webserver, and the second being sent by TCPDF when it pushes the file out.

Link to comment
Share on other sites

  • 2 months later...

Upgraded to 3.2.2. issue not fixed.

 

Are you sure you overwrote all of the necessary files? Specifically the files affected by CORE-1349 are in /components/invoice_templates/. What would happen before CORE-1349 was that PDF invoices would send headers and output the PDF document, but execution would continue. This would result in additional headers being sent which produced an error of "cannot send headers, headers already sent".

 

As of CORE-1349, all invoice templates shipped with Blesta (default and quickbooks) now terminate execution immediately after the PDF is output, which completely prevents additional headers from being attempted. Moreover, no headers are sent prior to PDF output, so if CORE-1349 doesn't resolve the issue for you, the issue must be with either custom changes, or outside the control of Blesta (e.g. server related).

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

In ISPConfig I cnaged php settings from php-fpm to mod-php and now I can access invoice - it downloads as pdf. So the problem is not with web server but Blesta's pdf invoice only works with mod-php.

Thread is a little old but wanted to note that I use PHP-FPM and have never had any issues with invoices, so it is probably an issue with your configuration.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...