pdf report generation - content type text/html

pdf report generation - content type text/html

am 03.11.2009 20:20:27 von b k

--001636d348210324d604777c6371
Content-Type: text/plain; charset=ISO-8859-1

Hi all,
PDF reports are not being generated on any browser. On IE, I get the File
Save dialog and on Firefox, all weird characters get displayed. When I ran
this test again with HTTPFox and Fiddler, I noticed that the content-type in
the response header is *text/html* for this PDF report, which is definitely
causing the problem. I am using apache 2.2.3 with mod security turned on/off
(doesn't matter). Any help would be greatly appreciated!!!!

--001636d348210324d604777c6371
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi all,
PDF reports are not being generated on any browser. On IE, I ge=
t the File Save dialog and on Firefox, all weird characters get displayed. =
When I ran this test again with HTTPFox and Fiddler, I noticed that the con=
tent-type in the response header is text/html for this PDF report, w=
hich is definitely causing the problem. I am using apache 2.2.3 with mod se=
curity turned on/off (doesn't matter). Any help would be greatly apprec=
iated!!!!




--001636d348210324d604777c6371--

Re: pdf report generation - content type text/html

am 03.11.2009 20:26:10 von rambo

On Tue, 3 Nov 2009 14:20:27 -0500
b k wrote:

> Hi all,
> PDF reports are not being generated on any browser. [...]Any help would be greatly
> appreciated!!!!

Send Content-Type: application/pdf or application/octet-stream from your PDF generator
text/html is just plain wrong.

--
Maslow's Maxim:
If the only tool you have is a hammer, you treat everything like
a nail.

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: pdf report generation - content type text/html

am 03.11.2009 20:32:55 von Brian Mearns

On Tue, Nov 3, 2009 at 2:26 PM, Marcin 'Rambo' Roguski
wrote:
> On Tue, 3 Nov 2009 14:20:27 -0500
> b k wrote:
>
>> Hi all,
>> PDF reports are not being generated on any browser. [...]Any help would =
be greatly
>> appreciated!!!!
>
> Send Content-Type: application/pdf or application/octet-stream from your =
PDF generator
> text/html is just plain wrong.
>
> --
> Maslow's Maxim:
> =A0 =A0 =A0 =A0If the only tool you have is a hammer, you treat everythin=
g like
> =A0 =A0 =A0 =A0a nail.
>

Well what's generating the PDF's? If they're coming from a file, you
need to configure Apache to correctly detect the mime type (as with
mod_mime: http://httpd.apache.org/docs/2.2/mod/mod_mime.html). Or if
they're all accessed through a particular root URL (like
/reports/pdf/), you can use the tag and ForceType:
http://httpd.apache.org/docs/2.2/mod/core.html#forcetype.

If it's being generated by a server side script, you can try the above
method, or better, just get your script to generate the
correct Content-Type header. If you're using PHP, the default mime
type if you don't say otherwise is usually text/html, as you found,
but you can use the header() function to send the CT header like:
header("Content-Type: application/pdf").

-Brian

--=20
Feel free to contact me using PGP Encryption:
Key Id: 0x3AA70848
Available from: http://keys.gnupg.net

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: pdf report generation - content type text/html

am 03.11.2009 21:06:39 von b k

--000e0ce044923af0f104777d086b
Content-Type: text/plain; charset=ISO-8859-1

Thanks!! Actually, it's a java based app on the WebSphere app server that
sends the response to Apache web server which in turn sends the response to
the browser. I tested the reports directly on the App server which are
working fine. I suspect something is wrong in the apache config. I also
checked mime.types file which includes pdf entry.

On Tue, Nov 3, 2009 at 2:32 PM, Brian Mearns wrote:

> On Tue, Nov 3, 2009 at 2:26 PM, Marcin 'Rambo' Roguski
> wrote:
> > On Tue, 3 Nov 2009 14:20:27 -0500
> > b k wrote:
> >
> >> Hi all,
> >> PDF reports are not being generated on any browser. [...]Any help would
> be greatly
> >> appreciated!!!!
> >
> > Send Content-Type: application/pdf or application/octet-stream from your
> PDF generator
> > text/html is just plain wrong.
> >
> > --
> > Maslow's Maxim:
> > If the only tool you have is a hammer, you treat everything like
> > a nail.
> >
>
> Well what's generating the PDF's? If they're coming from a file, you
> need to configure Apache to correctly detect the mime type (as with
> mod_mime: http://httpd.apache.org/docs/2.2/mod/mod_mime.html). Or if
> they're all accessed through a particular root URL (like
> /reports/pdf/), you can use the tag and ForceType:
> http://httpd.apache.org/docs/2.2/mod/core.html#forcetype.
>
> If it's being generated by a server side script, you can try the above
> method, or better, just get your script to generate the
> correct Content-Type header. If you're using PHP, the default mime
> type if you don't say otherwise is usually text/html, as you found,
> but you can use the header() function to send the CT header like:
> header("Content-Type: application/pdf").
>
> -Brian
>
> --
> Feel free to contact me using PGP Encryption:
> Key Id: 0x3AA70848
> Available from: http://keys.gnupg.net
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

--000e0ce044923af0f104777d086b
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Thanks!! Actually, it's a java based app on the WebSphere app server th=
at sends the response to Apache web server which in turn sends the response=
to the browser. I tested the reports directly on the App server which are =
working fine. I suspect something is wrong in the apache config. I also che=
cked mime.types file which includes pdf entry.


On Tue, Nov 3, 2009 at 2:32 PM, Brian Mearns=
<mearns.b@gmail=
..com
>
wrote:
rder-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding=
-left: 1ex;">
On Tue, Nov 3, 2009 at 2:26 PM, Marcin 'Rambo' Ro=
guski

<> wrote:=


> On Tue, 3 Nov 2009 14:20:27 -0500

> b k <> w=
rote:

>

>> Hi all,

>> PDF reports are not being generated on any browser. [...]Any help =
would be greatly

>> appreciated!!!!

>

> Send Content-Type: application/pdf or application/octet-stream from yo=
ur PDF generator

> text/html is just plain wrong.

>

> --

> Maslow's Maxim:

> =A0 =A0 =A0 =A0If the only tool you have is a hammer, you treat everyt=
hing like

> =A0 =A0 =A0 =A0a nail.

>



Well what's generating the PDF's? If they're coming from =
a file, you

need to configure Apache to correctly detect the mime type (as with

mod_mime: rget=3D"_blank">http://httpd.apache.org/docs/2.2/mod/mod_mim e.html). Or=
if

they're all accessed through a particular root URL (like

/reports/pdf/), you can use the <Location> tag and ForceType:

=3D"_blank">http://httpd.apache.org/docs/2.2/mod/core.html#f orcetype. r>


If it's being generated by a server side script, you can try the above<=
br>
<Location> method, or better, just get your script to generate the >
correct Content-Type header. If you're using PHP, the default mime

type if you don't say otherwise is usually text/html, as you found,

but you can use the header() function to send the CT header like:

header("Content-Type: application/pdf").



-Brian



--

Feel free to contact me using PGP Encryption:

Key Id: 0x3AA70848

Available from: http://=
keys.gnupg.net




------------------------------------------------------------ ---------

The official User-To-User support forum of the Apache HTTP Server Project.<=
br>
See <URL: lank">http://httpd.apache.org/userslist.html> for more info.

To unsubscribe, e-mail: g">users-unsubscribe@httpd.apache.org

=A0 " =A0 from the digest: @httpd.apache.org">users-digest-unsubscribe@httpd.apache.org

For additional commands, e-mail: org">users-help@httpd.apache.org






--000e0ce044923af0f104777d086b--

Re: pdf report generation - content type text/html

am 03.11.2009 21:23:32 von aw

b k wrote:
> Thanks!! Actually, it's a java based app on the WebSphere app server that
> sends the response to Apache web server which in turn sends the response to
> the browser. I tested the reports directly on the App server which are
> working fine. I suspect something is wrong in the apache config. I also
> checked mime.types file which includes pdf entry.

Apache will only generate itself the "Content-Type" and
"Content-Disposition" response headers, if the file being served is a
file that Apache itself picks up from the filesystem. That is also when
it uses the mime.types file (to try and guess the type).

When it is an application which generates this data (or file), then it
is the responsibility of the application to add these 2 headers to the
response (at least the Content-Type).
When Apache sees a response about to go out, without a Content-Type
header, it will add one of it's own, but that is a default set in the
configuration, usually set to
Content-Type: text/html
(because that is the most likely on a webserver)

So, whatever your application is, it is probably not producing this or
these HTTP headers, which is why Apache adds its own default 'text/html'
header, and that is the reason for the problem.

To my knowledge, there is nothing in Apache that will remove a
Content-Type header set by an application and replace it by another one,
unless you have specifically configured it to do that.

There are additional miseries in this due to the inconsistency of IE
versions in interpreting the content coming from a webserver, but I
believe that would be a second step, and you need to resolve the one
above first.

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: pdf report generation - content type text/html

am 03.11.2009 21:43:53 von Brian Mearns

On Tue, Nov 3, 2009 at 3:06 PM, b k wrote:
> Thanks!! Actually, it's a java based app on the WebSphere app server that
> sends the response to Apache web server which in turn sends the response =
to
> the browser. I tested the reports directly on the App server which are
> working fine. I suspect something is wrong in the apache config. I also
> checked mime.types file which includes pdf entry.
>
> On Tue, Nov 3, 2009 at 2:32 PM, Brian Mearns wrote:
>>
>> On Tue, Nov 3, 2009 at 2:26 PM, Marcin 'Rambo' Roguski
>> wrote:
>> > On Tue, 3 Nov 2009 14:20:27 -0500
>> > b k wrote:
>> >
>> >> Hi all,
>> >> PDF reports are not being generated on any browser. [...]Any help wou=
ld
>> >> be greatly
>> >> appreciated!!!!
>> >
>> > Send Content-Type: application/pdf or application/octet-stream from yo=
ur
>> > PDF generator
>> > text/html is just plain wrong.
>> >
>> > --
>> > Maslow's Maxim:
>> > =A0 =A0 =A0 =A0If the only tool you have is a hammer, you treat everyt=
hing like
>> > =A0 =A0 =A0 =A0a nail.
>> >
>>
>> Well what's generating the PDF's? If they're coming from a file, you
>> need to configure Apache to correctly detect the mime type (as with
>> mod_mime: http://httpd.apache.org/docs/2.2/mod/mod_mime.html). Or if
>> they're all accessed through a particular root URL (like
>> /reports/pdf/), you can use the tag and ForceType:
>> http://httpd.apache.org/docs/2.2/mod/core.html#forcetype.
>>
>> If it's being generated by a server side script, you can try the above
>> method, or better, just get your script to generate the
>> correct Content-Type header. If you're using PHP, the default mime
>> type if you don't say otherwise is usually text/html, as you found,
>> but you can use the header() function to send the CT header like:
>> header("Content-Type: application/pdf").
>>
>> -Brian
>>
>> --
>> Feel free to contact me using PGP Encryption:
>> Key Id: 0x3AA70848
>> Available from: http://keys.gnupg.net

It sounds like you're saying you get the correct content-type header
if you communicate directly with the app server, and that Apache is
blowing it away? That's quite odd, but you might still try the
tag or similar to match the URL's the reports are accessed
by, and then use ForceType. I'm not sure if Apache will replace an
existing Content-Type header in this case, but it's worth a try.

-Brian


--=20
Feel free to contact me using PGP Encryption:
Key Id: 0x3AA70848
Available from: http://keys.gnupg.net

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: pdf report generation - content type text/html

am 16.11.2009 21:00:18 von b k

--00148531987375eb47047882757b
Content-Type: text/plain; charset=ISO-8859-1

I tried all possibilities but no luck yet. I just realized this morning that
the OS patch level on Test and Prod servers are different. Test reports are
working but not the Prod, may be due to fact that Test servers have LATEST
PATCH LEVEL??? Is it possible??? Please let me know.

On Tue, Nov 3, 2009 at 3:43 PM, Brian Mearns wrote:

> On Tue, Nov 3, 2009 at 3:06 PM, b k wrote:
> > Thanks!! Actually, it's a java based app on the WebSphere app server that
> > sends the response to Apache web server which in turn sends the response
> to
> > the browser. I tested the reports directly on the App server which are
> > working fine. I suspect something is wrong in the apache config. I also
> > checked mime.types file which includes pdf entry.
> >
> > On Tue, Nov 3, 2009 at 2:32 PM, Brian Mearns wrote:
> >>
> >> On Tue, Nov 3, 2009 at 2:26 PM, Marcin 'Rambo' Roguski
> >> wrote:
> >> > On Tue, 3 Nov 2009 14:20:27 -0500
> >> > b k wrote:
> >> >
> >> >> Hi all,
> >> >> PDF reports are not being generated on any browser. [...]Any help
> would
> >> >> be greatly
> >> >> appreciated!!!!
> >> >
> >> > Send Content-Type: application/pdf or application/octet-stream from
> your
> >> > PDF generator
> >> > text/html is just plain wrong.
> >> >
> >> > --
> >> > Maslow's Maxim:
> >> > If the only tool you have is a hammer, you treat everything
> like
> >> > a nail.
> >> >
> >>
> >> Well what's generating the PDF's? If they're coming from a file, you
> >> need to configure Apache to correctly detect the mime type (as with
> >> mod_mime: http://httpd.apache.org/docs/2.2/mod/mod_mime.html). Or if
> >> they're all accessed through a particular root URL (like
> >> /reports/pdf/), you can use the tag and ForceType:
> >> http://httpd.apache.org/docs/2.2/mod/core.html#forcetype.
> >>
> >> If it's being generated by a server side script, you can try the above
> >> method, or better, just get your script to generate the
> >> correct Content-Type header. If you're using PHP, the default mime
> >> type if you don't say otherwise is usually text/html, as you found,
> >> but you can use the header() function to send the CT header like:
> >> header("Content-Type: application/pdf").
> >>
> >> -Brian
> >>
> >> --
> >> Feel free to contact me using PGP Encryption:
> >> Key Id: 0x3AA70848
> >> Available from: http://keys.gnupg.net
>
> It sounds like you're saying you get the correct content-type header
> if you communicate directly with the app server, and that Apache is
> blowing it away? That's quite odd, but you might still try the
> tag or similar to match the URL's the reports are accessed
> by, and then use ForceType. I'm not sure if Apache will replace an
> existing Content-Type header in this case, but it's worth a try.
>
> -Brian
>
>
> --
> Feel free to contact me using PGP Encryption:
> Key Id: 0x3AA70848
> Available from: http://keys.gnupg.net
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

--00148531987375eb47047882757b
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I tried all possibilities but no luck yet. I just realized this morning tha=
t the OS patch level on Test and Prod servers are different. Test reports a=
re working but not the Prod, may be due to fact that Test servers have LATE=
ST PATCH LEVEL??? Is it possible??? Please let me know.


On Tue, Nov 3, 2009 at 3:43 PM, Brian Mearns=
<mearns.b@gmail=
..com
>
wrote:
rder-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding=
-left: 1ex;">
On Tue, Nov 3, 2009 at 3:06 PM, b k <<=
a href=3D"mailto:bk4web@gmail.com">bk4web@gmail.com> wrote:

> Thanks!! Actually, it's a java based app on the WebSphere app serv=
er that

> sends the response to Apache web server which in turn sends the respon=
se to

> the browser. I tested the reports directly on the App server which are=


> working fine. I suspect something is wrong in the apache config. I als=
o

> checked mime.types file which includes pdf entry.

>

> On Tue, Nov 3, 2009 at 2:32 PM, Brian Mearns < rns.b@gmail.com">mearns.b@gmail.com> wrote:

>>

>> On Tue, Nov 3, 2009 at 2:26 PM, Marcin 'Rambo' Roguski

>> <&g=
t; wrote:

>> > On Tue, 3 Nov 2009 14:20:27 -0500

>> > b k <bk4web@gmail.com<=
/a>> wrote:

>> >

>> >> Hi all,

>> >> PDF reports are not being generated on any browser. [...]=
Any help would

>> >> be greatly

>> >> appreciated!!!!

>> >

>> > Send Content-Type: application/pdf or application/octet-strea=
m from your

>> > PDF generator

>> > text/html is just plain wrong.

>> >

>> > --

>> > Maslow's Maxim:

>> > =A0 =A0 =A0 =A0If the only tool you have is a hammer, you tre=
at everything like

>> > =A0 =A0 =A0 =A0a nail.

>> >

>>

>> Well what's generating the PDF's? If they're coming fr=
om a file, you

>> need to configure Apache to correctly detect the mime type (as wit=
h

>> mod_mime:
..html" target=3D"_blank">http://httpd.apache.org/docs/2.2/mod/mod_m ime.html=
). Or if

>> they're all accessed through a particular root URL (like

>> /reports/pdf/), you can use the <Location> tag and ForceType=
:

>> e" target=3D"_blank">http://httpd.apache.org/docs/2.2/mod/core. html#forcety=
pe
.

>>

>> If it's being generated by a server side script, you can try t=
he above

>> <Location> method, or better, just get your script to genera=
te the

>> correct Content-Type header. If you're using PHP, the default =
mime

>> type if you don't say otherwise is usually text/html, as you f=
ound,

>> but you can use the header() function to send the CT header like:<=
br>
>> header("Content-Type: application/pdf").

>>

>> -Brian

>>

>> --

>> Feel free to contact me using PGP Encryption:

>> Key Id: 0x3AA70848

>> Available from: ">http://keys.gnupg.net



It sounds like you're saying you get the correct content-ty=
pe header

if you communicate directly with the app server, and that Apache is

blowing it away? That's quite odd, but you might still try the

<Location> tag or similar to match the URL's the reports are acce=
ssed

by, and then use ForceType. I'm not sure if Apache will replace an

existing Content-Type header in this case, but it's worth a try.



-Brian





--

Feel free to contact me using PGP Encryption:

Key Id: 0x3AA70848

Available from: http://=
keys.gnupg.net




------------------------------------------------------------ ---------

The official User-To-User support forum of the Apache HTTP Server Project.<=
br>
See <URL: lank">http://httpd.apache.org/userslist.html> for more info.

To unsubscribe, e-mail: g">users-unsubscribe@httpd.apache.org

=A0 " =A0 from the digest: @httpd.apache.org">users-digest-unsubscribe@httpd.apache.org

For additional commands, e-mail: org">users-help@httpd.apache.org






--00148531987375eb47047882757b--

Re: pdf report generation - content type text/html

am 16.11.2009 21:13:02 von Philip Wigg

> I tried all possibilities but no luck yet. I just realized this morning that
> the OS patch level on Test and Prod servers are different. Test reports are
> working but not the Prod, may be due to fact that Test servers have LATEST
> PATCH LEVEL??? Is it possible??? Please let me know.

It's quite possibly due to some differences in the application server
configuration, you're probably best asking IBM. Possibly it's
something like this:-

http://www-01.ibm.com/support/docview.wss?rs=2169&context=SS 5K3U&dc=DB550&q1=JR30578&uid=swg1JR30578&loc=en_US&cs=utf-8& lang=en

It doesn't sound like the problem is due to Apache though.

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: pdf report generation - content type text/html

am 17.11.2009 03:34:30 von b k

--000e0cd1fd72333729047887f70a
Content-Type: text/plain; charset=ISO-8859-1

thanks for ur input. But, as I said before, the reports work directly on the
app server. However, the report fails to open if you provide a smaller date
range (period) and works fine with a bigger date range. Is there any setting
on web server that I need to check for min/max response data size or
something like that. pls let me know.

On Mon, Nov 16, 2009 at 3:13 PM, Philip Wigg wrote:

> > I tried all possibilities but no luck yet. I just realized this morning
> that
> > the OS patch level on Test and Prod servers are different. Test reports
> are
> > working but not the Prod, may be due to fact that Test servers have
> LATEST
> > PATCH LEVEL??? Is it possible??? Please let me know.
>
> It's quite possibly due to some differences in the application server
> configuration, you're probably best asking IBM. Possibly it's
> something like this:-
>
>
> http://www-01.ibm.com/support/docview.wss?rs=2169&context=SS 5K3U&dc=DB550&q1=JR30578&uid=swg1JR30578&loc=en_US&cs=utf-8& lang=en
>
> It doesn't sound like the problem is due to Apache though.
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

--000e0cd1fd72333729047887f70a
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

thanks for ur input. But, as I said before, the reports work directly on th=
e app server. However, the report fails to open if you provide a smaller da=
te range (period) and works fine with a bigger date range. Is there any set=
ting on web server that I need to check for min/max response data size or s=
omething like that. pls let me know.


On Mon, Nov 16, 2009 at 3:13 PM, Philip Wigg=
<phil@philip=
wigg.co.uk
>
wrote:
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
> I tried all possibilities but no luck yet. I just re=
alized this morning that

> the OS patch level on Test and Prod servers are different. Test report=
s are

> working but not the Prod, may be due to fact that Test servers have LA=
TEST

> PATCH LEVEL??? Is it possible??? Please let me know.



It's quite possibly due to some differences in the application se=
rver

configuration, you're probably best asking IBM. Possibly it's

something like this:-



=3DSS5K3U&dc=3DDB550&q1=3DJR30578&uid=3Dswg1JR30 578&loc=3De=
n_US&cs=3Dutf-8&lang=3Den" target=3D"_blank">http://www-01.ibm.com/=
support/docview.wss?rs=3D2169&context=3DSS5K3U&dc=3D DB550&q1=3D=
JR30578&uid=3Dswg1JR30578&loc=3Den_US&cs=3Dutf-8 &lang=3Den<=
/a>




It doesn't sound like the problem is due to Apache though.




--000e0cd1fd72333729047887f70a--