Project

General

Profile

fcgi & url issues while moving from Hiawatha

Added by dinkan about 11 years ago

Hi,

We are moving from Hiawatha webserver to Lighty.
I want to make this transfer as transparent as possible without making any change to FCGI application.

In Hiawatha, we have a configuration line in the UrlToolKit block

Match ^/load_app UseFastCGI app_loader

which means, if the request URL is /load_app/index.html or /load_app/appOne or /load_app/appTwo/index.html or anything that starts with /load_app will be passed to app_loader FCGI application.
Similar to this we have many request URLs handled by different FCGI applications.
How do I get this done on Lighty?

The configuration
"/load_app/" =>
(("host" => "127.0.0.1",
"port" => 2020,
"check-local" => "disable"
)),

only handled /load_app/index.html, but not /load_app/appTwo/index.html or /load_app/js/validate.js

I want to make this change of webserver as transparent as possible, so any lighty configuration must not change the SCRIPT_NAME, REQUEST_URI or QUERY_STRING.
Changing those variables will break the FCGI application.


Replies (8)

RE: fcgi & url issues while moving from Hiawatha - Added by darix about 11 years ago

try without the trailing "/"

also see debug.log-request-handling = "enable" and check error.log, also see http://redmine.lighttpd.net/projects/lighttpd/wiki/DebugVariables

RE: fcgi & url issues while moving from Hiawatha - Added by dinkan about 11 years ago

Thank you Darix.

Unfortunately it did not work for me.

For request
/load_app/help/index.html?a=0&b=xyz&c=1232

This is just an example, the request could be
/load_app/index.html
/load_app/help/js/jquery.latest.min.js
/load_app/sdk/ext_sdk.js
/load_app/css/common/ex.css
/loader/common/js/keyb/css/keyb.css
and many many more directories & scripts with GETS & POSTS

Case 1
in Hiawatha with following configuration, all above request combinations worked perfect


FastCGIserver {
FastCGIid = app_loader
ConnectTo 127.0.0.1:2020
Extension = fcgi
SessionTimeout = 30
}


Match ^/load_app UseFastCGI app_loader

All requests starting with /load_app is sent to app_loader WITHOUT manipulating SCRIPT_NAME

SCRIPT_NAME /loader/help/index.html

Case 2
with "/load_app/" (with trailing / )

2013-03-04 23:31:10: (response.c.300) -- splitting Request-URI
2013-03-04 23:31:10: (response.c.301) Request-URI : /load_app/help/index.html?a=0&b=xyz&c=1232
2013-03-04 23:31:10: (response.c.302) URI-scheme : https
2013-03-04 23:31:10: (response.c.303) URI-authority: localhost
2013-03-04 23:31:10: (response.c.304) URI-path : /load_app/help/index.html
2013-03-04 23:31:10: (response.c.305) URI-query : a=0&b=xyz&c=1232
2013-03-04 23:31:10: (response.c.349) -- sanatising URI
2013-03-04 23:31:10: (response.c.350) URI-path : /load_app/help/index.html
2013-03-04 23:31:10: (mod_access.c.135) -- mod_access_uri_handler called
2013-03-04 23:31:10: (mod_fastcgi.c.3609) handling it in mod_fastcgi
2013-03-04 23:31:10: (response.c.470) -- before doc_root
2013-03-04 23:31:10: (response.c.471) Doc-Root : /home/web/root
2013-03-04 23:31:10: (response.c.472) Rel-Path : /load_app/help
2013-03-04 23:31:10: (response.c.473) Path :
2013-03-04 23:31:10: (response.c.521) -- after doc_root
2013-03-04 23:31:10: (response.c.522) Doc-Root : /home/web/root
2013-03-04 23:31:10: (response.c.523) Rel-Path : /load_app/help
2013-03-04 23:31:10: (response.c.524) Path : /home/web/root/load_app/help
2013-03-04 23:31:10: (response.c.541) -- logical -> physical
2013-03-04 23:31:10: (response.c.542) Doc-Root : /home/web/root
2013-03-04 23:31:10: (response.c.543) Rel-Path : /loader/help
2013-03-04 23:31:10: (response.c.544) Path : */home/web/root/load_app/help*
2013-03-04 23:31:10: (mod_fastcgi.c.3035) got proc: pid: 0 socket: tcp:127.0.0.1:2020 load: 1
2013-03-04 23:31:10: (mod_fastcgi.c.1490) released proc: pid: 0 socket: tcp:127.0.0.1:2020 load: 0

SCRIPT_NAME variable is now /load_app/help

Case 3
with "/load_app" (no trailing / )

2013-03-04 23:25:03: (response.c.300) -- splitting Request-URI
2013-03-04 23:25:03: (response.c.301) Request-URI : /load_app/help/index.html?a=0&b=xyz&c=1232
2013-03-04 23:25:03: (response.c.302) URI-scheme : https
2013-03-04 23:25:03: (response.c.303) URI-authority: localhost
2013-03-04 23:25:03: (response.c.304) URI-path : /load_app/help/index.html
2013-03-04 23:25:03: (response.c.305) URI-query : a=0&b=xyz&c=1232
2013-03-04 23:25:03: (response.c.349) -- sanatising URI
2013-03-04 23:25:03: (response.c.350) URI-path : /load_app/help/index.html
2013-03-04 23:25:03: (mod_access.c.135) -- mod_access_uri_handler called
2013-03-04 23:25:03: (mod_fastcgi.c.3609) handling it in mod_fastcgi
2013-03-04 23:25:03: (response.c.470) -- before doc_root
2013-03-04 23:25:03: (response.c.471) Doc-Root : /home/web/root
2013-03-04 23:25:03: (response.c.472) Rel-Path : /load_app
2013-03-04 23:25:03: (response.c.473) Path :
2013-03-04 23:25:03: (response.c.521) -- after doc_root
2013-03-04 23:25:03: (response.c.522) Doc-Root : /home/web/root
2013-03-04 23:25:03: (response.c.523) Rel-Path : /load_app
2013-03-04 23:25:03: (response.c.524) Path : /home/web/root/load_app
2013-03-04 23:25:03: (response.c.541) -- logical -> physical
2013-03-04 23:25:03: (response.c.542) Doc-Root : /home/web/root
2013-03-04 23:25:03: (response.c.543) Rel-Path : /load_app
2013-03-04 23:25:03: (response.c.544) Path : */home/web/root/load_app*
2013-03-04 23:25:03: (mod_fastcgi.c.3035) got proc: pid: 0 socket: tcp:127.0.0.1:2020 load: 1
2013-03-04 23:25:03: (mod_fastcgi.c.1490) released proc: pid: 0 socket: tcp:127.0.0.1:2020 load: 0

SCRIPT_NAME variable is now /load_app

Writing one FCGI entry for each possible directory might work, but that is going to be dirty, buggy & hard to maintain.

Hope I explained my issue, please help me fix it.

Thanks
Dinkan

RE: fcgi & url issues while moving from Hiawatha - Added by dinkan about 11 years ago

I'm totally out of ideas.
Any help appreciated!

RE: fcgi & url issues while moving from Hiawatha - Added by darix about 11 years ago

but as you see it is already sending the request to your fastcgi app.

RE: fcgi & url issues while moving from Hiawatha - Added by dinkan about 11 years ago

darix wrote:

but as you see it is already sending the request to your fastcgi app.

Lighttpd corrupted/changed the SCRIPT_NAME before sending to the app
but Hiawatha didn't manipulated the incoming data, it simply passed it to the fasctcgi.

How could I configure the Lighttpd to avoid that

RE: fcgi & url issues while moving from Hiawatha - Added by darix about 11 years ago

script name is set by lighttpd not by anything else.

RE: fcgi & url issues while moving from Hiawatha - Added by dinkan about 11 years ago

darix wrote:

script name is set by lighttpd not by anything else.

Sorry Darix, I did not understand the answer.
please forgive me...

Let me rephrase my basic question

on Hiawatha webserver, the request
/load_app/help/index.html?a=0&b=xyz&c=1232
will meet the condition
Match ^/load_app UseFastCGI app_loader
on the Hiawatha conf file
& all requests including the ones below
that match the ^/load_app will be send to app_loader fcgi app WITHOUT truncated SCRIPT_NAME.
Others possible requests
/load_app/index.html
/load_app/help/js/jquery.js
/load_app/sdk/ext_sdk.js
/load_app/css/common/ex.css
/loader/common/js/keyb/css/keyb.css
and many many more directories & scripts with GETS & POSTS

We want to use Lighttpd instead of Hiawatha webserver without changing the FCGI application.
How is that possible?

For request /load_app/help/index.html?a=0&b=xyz&c=1232
The SCRIPT_NAME expected by fastcgi app is /load_app/help/index.html

BUT with LIGHTTPD configuration
"/load_app/" =>
(("host" => "127.0.0.1",
"port" => 2020,
"check-local" => "disable"
)),
The SCRIPT_NAME is /load_app/help. This BREAKS the fasctcgi app

As per your suggestion I changed the LIGHTTPD configuration to
"/load_app" => (no trailing /)
(("host" => "127.0.0.1",
"port" => 2020,
"check-local" => "disable"
)),
The SCRIPT_NAME is now /load_app. This again BREAKS the fasctcgi app

I know how to make one URL work, but I want a generic rule which matches ^/load_app, but will have the complete URL as SCRIPT_NAME(except URI-query).

How do I configure lighttpd to get this done?

Thanks again Darix

    (1-8/8)