Re: [Cppcms-users] Potential patch / suggestion
Brought to you by:
artyom-beilis
From: Artyom B. <art...@gm...> - 2020-06-18 11:58:33
|
On Wed, Jun 10, 2020 at 3:52 AM Jon Foster <jon...@jf...> wrote: > > Hi guys! > > It doesn't look like there is a whole lot going on here. Is this the best > place to discuss C++CMS? > Yes it is, also you can post patches/pull requests on github > I'm attaching a simple patch that I used to make URL handling in the native > HTTP server work better. Using URL rewriting to get around weaknesses in > the internal dispatching is just plain silly and counter productive. An app > running in the HTTP server should work the same as it would running fCGI > from Apache or NginX, without needing code changes. In the usual OOP and > Unix philosophies it should plug in and run, essentially the same, where > ever you put it. This is not a completed patch. I'm including it as an > example and to open a discussion if there is interest. Its actually working > well for me already. Here's the patch: > In general under most servers you map your fastcgi to a specific location and files to other location. So if you work with /foo.cgi/bal/bla Or all logic from there: /foo/ You can go with it. But if you want to have / as root if your application and files served from other places you need some rules: http://cppcms.com/wikipp/en/page/run_application_web_server_root Finally you most likely want that your server will serve files and you'll handle dynamic content. > This does a few things for me: > > 1. Allows me to move static file serving off of "/", so an app can be > there. Web apps typically provide limited URL sets that serve static files. > The rest of the URL space being covered by the "app". > > 2. Allows me to serve an app from "/", which is actually "" in the config file. > > 3. The last bit of the patch just fixes a misspelling that I found > humorous. :-) > > I think a "final solution" would be one that is more cooperative. Probably > allowing the APP to pick and choose the URLs to serve and then fall back to > static, or a more PHP style: look for static files and if not found hand > the request off to the app. Both of these scenarios could be programmed to > happen if the file_server was not _hidden_ as _private_, but instead made > available as a pluggable app. > It is very different from PHP - you don't have c++ scripts running around. Finally if you want to have both static files and your application be served by the server you need some rules. It is done using rewriting. Internal server (intended for development/embedded use) does it in same way. Artyom |