[Lazarus] httpWebServer does not show images for some users

Michael Van Canneyt michael at freepascal.org
Sat Jul 7 09:31:44 CEST 2012



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.




More information about the Lazarus mailing list