[Lazarus] EmbWeb: Moving between webapp type caveats

Michael Van Canneyt michael at freepascal.org
Sat Jun 11 22:44:44 CEST 2011



On Sat, 11 Jun 2011, leledumbo wrote:

> I realize that when I change from embedded server to, for instance, CGI, some
> things must be adjusted. For example, I use TRequest.ScriptName to get the
> base path of my web. This seems OK for CGI but not for embedded server,
> because it's not set there. I even got almost totally different environment
> variables set!

This is normal, because you don't need the environment in the embedded server. 
You don't need the environment at all in a CGI app as well. The whole point of 
fpweb is to abstract away the source of the information of the request.

[snip]
>
> The one from embedded server looks like my computer environment, while the
> CGI one seems to be set by the underlying web server (Apache in this case).
>
> So, how can I get the base web path (like localhost:12000/executable-name)
> in embedded server? I need to do this because links to other parts of the
> website must be relative to it.


The Application.ApplicationURL is set to this. 
In a webmodule, the module's URL is available in BaseURL.

Michael.




More information about the Lazarus mailing list