Support #2384
closedServer does not process http requests under apache
0%
Description
Hello! I use static resource to process some http-request. It's added by WServer::addResource().
With built-in wt server everything is ok, but when I deploy my web application using apache my WResouce::handleRequest() does not execute when I send requests.
How to make it work?
Files
Updated by Koen Deforche about 11 years ago
- Status changed from New to Feedback
Hey,
The use of addResource() with a FastCGI connector is a bit contrived: you first need to make sure that the request is forwarded from apache to the Wt FCGI application. The addResource() API calls in WServer then take a 'pathInfo' argument really as the URL, so they aren't absolute URLs but URLs relative to the 'deployment path'.
Regards,
koen
Updated by Vitaly Volochay about 11 years ago
Thanks, Koen! Than the answer is how to forward request from apache to my Wt FCGI application?
I have application with static resource added to path '/service':
server.addResource(new MyResource, "/service");
Assume I have simple apache (which is not true actually, in real one I use proxy pass + rewrite engine) config:
<IfModule mod_fcgid.c>
Listen 10101
NameVirtualHost *:10101
<VirtualHost *:10101>
IdleTimeout 3600
ProcessLifeTime 7200
IPCConnectTimeout 300
IPCCommTimeout 7200
BusyTimeout 300
DocumentRoot /var/www/myapp/docroot/
AddHandler fcgid-script wt
DirectoryIndex my_app.wt
Order Deny,Allow
Allow from all
Options +ExecCGI -Indexes
FcgidInitialEnv WT_APP_ROOT /var/www/myapp/approot/
SetEnv MYAPP_CONF_PARAM my_app.xml
When I am trying:
curl -X POST http://localhost:10101/my_app.wt/service
Server returns js code of server (seems to me like this), same as i send request to http://localhost:10101/my_app.wt. Obviously /server resource does not proccess it.
So how to make correct forwarding requests from apache to wt app?
Updated by Koen Deforche about 11 years ago
- Status changed from Feedback to InProgress
- Assignee set to Koen Deforche
Hey,
Your setup looks indeed correct. We will see if we can reproduce this issue. Is the configuration above really the actual configuration since you say that you actually use a proxy_pass + rewrite engine?
Regards,
koen
Updated by Vitaly Volochay about 11 years ago
- File wt_app_apache.conf wt_app_apache.conf added
Thanks for you help!
I attached my real configuration. I tried both configs and requests didn't reach wt application.
Updated by Koen Deforche about 11 years ago
- Status changed from InProgress to Feedback
Hey,
Sorry that it took some time, but I've now tested this again and it does work as expected for me. One thing to note is that the order of the entry paths is taken into account. You should thus deploy the resource before you deploy the actual application:
server.addResource(resource, "/service);
server.addEntryPoint(Application, ..., "");
I tested this with the blog example, so you may want to see if that does work for you and if so what is the difference with your project.
Regards,
koen
Updated by Vitaly Volochay about 11 years ago
Thx, Koen! Issue with order solve the problem.
Updated by Koen Deforche about 11 years ago
- Status changed from Feedback to Closed