Hi Koen!

On Mon, Jul 11, 2016 at 11:06 AM, Koen Deforche <k...@emweb.be> wrote:
> Hey,
>
> 2016-07-11 16:24 GMT+02:00 K. Frank <kfrank2...@gmail.com>:
>>
>> Hello List!
>>
>> I am building my app to be a wthttpd server.  When I start it from the
>> command line, I pass it the --docroot argument, for example, as:
>>
>>    mixed_links --http-address=0.0.0.0 --http-port=80
>> --deploy-path=/mixed_links --docroot=".;/static_links"
>
> In this call, --docroot=".;/static_links" is equivalent to --docroot=".".

Thank you for your reply.

Some follow up questions:

Is the following true?  If the deploy-path does not end in "/", then the ";"
docroot syntax does nothing.  That is, the ";" and anything after it is
effectively ignored.

Is it true -- regardless of whether deploy-path ends in "/" -- that
WApplication::docRoot() only returns the part of the --docroot
command-line argument that appears before the ";"?  In a similar
vein, does Wt provide a public api that gives the part of docroot
after the ";" (or the whole docroot string)?

> The ';/path1,/path2,.." syntax is only used to get rid of so-called "ugly
> internal path URLs" that are encoded as a query argument
> '?_=/internal/path'. This is used in Wt only if you're deploying on a path
> that ends itself with a '/', for example --deploy-path=/mixed_links/ or the
> default --deploy-path='/'. In that case it is used to be able to use
> nice-looking internal paths (/internal/path) while still knowing which paths
> ('/static_links') to have handled by the static file server of wthttpd. If
> the application is not deployed ending with a '/' then there is no ambiguity
> in the first place.

I don't know whether I care about using a deploy-path the ends in "/",
and avoiding ugly paths sounds good.  But, regardless, I am trying to
understand what is going on.

I *think* I have "--deploy-path=/" working the way you describe, but,
for the life of me, I can't get "--deploy-path=/mixed_links/" to work
with the ";" syntax the way I imagine it might.

Let me summarize my set up:  I have a subdirectory of my current
working directory called static_links.  In it is a file, say, link1.html.  If
I deploy as "--deploy-path=/mixed_links/", a link (that evaluates) to:

   http://localhost/static_links/link1.html

links to the file successfully whether or not I use ";".  That is, both
"--docroot="."" and "--docroot'".;/static_links"" work the same way,
in that wthttpd serves link1.html as static content.

On the other hand, a link (that evaluates) to:

   http://localhost/mixed_links/static_links/link1.html

does not successfully link to the file.  The ";" syntax does have an
effect, however.  If I deploy with "--docroot="."", the above link returns
a 404, while if I deploy with "--docroot=.;/static_links", the above link
gets processed as an internal path in my application (but wthttpd does
not serve the link1.html file as static content).

So I don't see how to use ";" in this case.  (One version of the link works
with or without the ";", while the other version of the link does not work,
with or without the ";".)

> Since you are not having ugly internal paths to start with (you may even not
> be using them?), you probably want something different, but from your
> explanation I'm not exactly sure what.

Well, right now, I am just trying to understand how things work.  (Right now,
I'm playing around, but my "learning goal" would be to serve a web site with
wthttpd at "http://hostname/"; or, if necessary, "http://hostname/app_name";
and have both internal-path links and static-content links underneath that
top-level "landing page," e.g., "http://hostname/internal_path_link1"; and
"http://hostname/static_content_link";.)

Just to be clear, I may be trying to do something that wthttpd doesn't do
(or doesn't do without some sort of hackery).  That's okay, too.  I just
want to understand what wthttpd (and Wt in general) does do, and, then,
how to do it.

> The docroot directive is really
> similar to the 'docroot' as you would configure them in any other webserver
> such as apache or nginx.

Well, the only webserver I have experimented with in any detail in wthttpd, so
I haven't been able to take much guidance from "standard practice."

> Admittedly, it's a common, recurring, confusing topic all-together.

And, admittedly, I am recurringly confused ...

I apologize for my confusion, but perhaps a few more words of explanation
about --docroot, its ";" syntax, and how they interact with --deploy-path might
help clear things up in part for me.

> Koen


Thanks again for your helpful explanations.


K. Frank

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to