[Lazarus] httpWebServer does not show images for some users

John Repucci john.repucci at gmail.com
Sat Jul 7 17:42:27 CEST 2012

> Message: 2
> Date: Sat, 7 Jul 2012 09:31:44 +0200 (CEST)
> From: Michael Van Canneyt <michael at freepascal.org>
> Subject: Re: [Lazarus] httpWebServer does not show images for some
>         users
> To: Lazarus mailing list <lazarus at lists.lazarus.freepascal.org>
> Message-ID: <alpine.DEB.2.00.1207070925320.11517 at home.telenet.be>
> Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
> On Fri, 6 Jul 2012, John Repucci wrote:
>> I've been playing around with the httpwebserver and having problems
>> getting it to display images.
>> see: http://www.lazarus.freepascal.org/index.php/topic,17296.0.html
>> for some history on this.
>> I've added the project if you care to look at it.
>> Neither Reinier or I see the image when we compile the app, but
>> Leledumbo does see the image.
> I also could see the image, but the URL I had to use is:
> http://localhost:8081/img/index.html
> The reason for this is that you have 2 modules in your application.
> If you do not specify a path, the webserver has no way of determining
> what module it should invoke. There is a property 'AllowDefaultModule'
> which will allow to select a default module if no module name is found.
> Then, if you have multiple modules, you need to tell the webserver which
> is the default module to use. You can do this by setting DefaultModuleName.
> So, I set up the project file by adding
>    Application.AllowDefaultModule:=True;
>    Application.DefaultModuleName:='img';
> before
>    Application.initialize;
> and then everything worked fine with the URL:
> http://localhost:8081/index.html
> Michael.


After adding the above lines (thank you) and using
http://localhost:8081/index.html, I get a blank page (and nothing on
the source page).  (tested using both FF and Chrome)

The only way I am able to see the expected web page is by using:
http://localhost:8081/main/default (still no image).

When I use Application.DefaultModuleName:='main', then going to
http://localhost:8081/ I see the expected page (still no image).

re: Modules - I have two modules?  I see the Main module (
RegisterHTTPModule('Main', TMain)), but where is the 2nd module?
'img' is suppose to be the location for my image files.  (in this
case, in the same directory as the application)

More information about the Lazarus mailing list