[erlang-questions] Serving PDF using Nitrogen/Inets

35 views
Skip to first unread message

John Hughes

unread,
Mar 7, 2012, 11:35:59 AM3/7/12
to erlang-q...@erlang.org
I’m having trouble serving static pdf files using nitrogen (running on inets for the time being). I think they’re being served with the wrong content type: my browser treats them as text and displays the PDF source; moreover, if I try to “save the page” then a .txt is appended to the file name (I’m running on Windows 7). This happens if I visit a URL such as http://localhost:8000/file.pdf in my browser (with nitrogen running on the same machine).
 
Any idea what’s going on, or how I can fix it?
 
John

Garrett Smith

unread,
Mar 7, 2012, 4:09:38 PM3/7/12
to John Hughes, erlang-q...@erlang.org
On Wed, Mar 7, 2012 at 10:35 AM, John Hughes <john....@quviq.com> wrote:
> I’m having trouble serving static pdf files using nitrogen (running on inets
> for the time being). I think they’re being served with the wrong content
> type: my browser treats them as text and displays the PDF source; moreover,
> if I try to “save the page” then a .txt is appended to the file name (I’m
> running on Windows 7). This happens if I visit a URL such as
> http://localhost:8000/file.pdf in my browser (with nitrogen running on the
> same machine).

When I use httpd/inets with modlib, I need to explicitly configure
MIME types, even for images, css, etc. I wonder if Nitrogen does the
same thing but has omitted pdf.

You're seeing other mime types come through? E.g. css -> text/css?

Garrett
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Jesse Gumm

unread,
Mar 7, 2012, 4:41:38 PM3/7/12
to Garrett Smith, erlang-q...@erlang.org
Hi John,

In your nitrogen installation, check out /etc/inets_httpd.env, which
defines a few common mimetypes for inets.

https://github.com/nitrogen/nitrogen/blob/master/rel/overlay/inets/etc/inets_httpd.erlenv

-Jesse

--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

John Hughes

unread,
Mar 9, 2012, 4:49:27 AM3/9/12
to Jesse Gumm, Garrett Smith, erlang-q...@erlang.org
Thank you! Problem solved. That's a useful file to know about!

John

-----Ursprungligt meddelande-----
From: Jesse Gumm
Sent: Wednesday, March 07, 2012 10:41 PM
To: Garrett Smith
Cc: John Hughes ; erlang-q...@erlang.org
Subject: Re: [erlang-questions] Serving PDF using Nitrogen/Inets

Jesse Gumm

unread,
Mar 9, 2012, 10:46:56 AM3/9/12
to John Hughes, erlang-q...@erlang.org

Excellent!

Glad that helped.

Take care,

-Jesse

--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866

www.sigma-star.com
@jessegumm

Reply all
Reply to author
Forward
0 new messages