cherokee / webserver

Cherokee Web Server
GNU General Public License v2.0
568 stars 104 forks source link

Problem using Reverse Proxy in the latest release from branch master (stable) #1182

Open enrique-quinteros opened 8 years ago

enrique-quinteros commented 8 years ago

Hello, I have downloaded the latest release from the branch master (https://github.com/cherokee/webserver/archive/master.zip). I've compiled the source and installed Cherokee without a problem. However when I tried to use the Reverse Proxy functionality in this release (I had 1.2.103 previously installed), Cherokee doesn't proxy the context properly.

Example:

This behavior didn't happen in previous releases.

Something really weird happens when I disable the Directory Rule and I let the request go through the Default Rule, it works properly.

So I think It has something to do specifically with the Directory Rule.

Please if anyone can give me some guide to solve this problem, I will really appreciate it. Thanks.

skinkie commented 8 years ago

I'm using the proxy on all my systems. Is the source configured with an IP address opposed to a DNS name?

enrique-quinteros commented 8 years ago

Hello skinkie, thank you for the quick reply, yes the source is configured with an IP Address

source!1!env!PHP_FCGI _CHILDREN = 5 source!1!env!PHP_FCGI_MAX_REQUESTS = 490 source!1!env_inherited = 0 source!1!host = 127.0.0.1:47990 source!1!interpreter = /usr/bin/php-cgi -b 127.0.0.1:47990 source!1!nick = PHP Interpreter source!1!type = interpreter source!2!host = 196.11.10.99:7001 source!2!nick = Weblogic 8.1 source!2!type = host source!3!host = 196.11.10.195:7001 source!3!nick = Weblogic 8.1 Server 2 source!3!type = host

Should I use a DNS name instead?

Regards...

skinkie commented 8 years ago

No. The IP is the requirement. My tip would be change the Directory match to a regular expression like: ^/website/.*

The behavior as you describe above is the correct behavior. With directory it should not include /website only the last part of the path.

enrique-quinteros commented 8 years ago

Thanks! it worked with regular expressions, i had to add one more rule though (bold text):

vserver!2!rule!201!match = or vserver!2!rule!201!match!left = request vserver!2!rule!201!match!left!directory = /website vserver!2!rule!201!match!left!request = ^/website/.* vserver!2!rule!201!match!right = request vserver!2!rule!201!match!right!request = ^/website

I don't know why the rule directory is still in the conf (italic text), I deleted it with the admin.

Do you know what is the problem with the directory rule?

skinkie commented 8 years ago

Do you know what is the problem with the directory rule?

Actually it is doing what it is supposed to do. The idea is that if you would run a service on /myservice that /myservice/firstrequest should be /firstrequest on the backend service not /myservice/firstrequest

Directory strips that. Regular expression doesn't...

Stefan

enrique-quinteros commented 8 years ago

But that behavior is for the latest version? Because I had two cherokee servers with 1.2.103 and both work with the directory rule and they do work well:

-> Version 1.2.103: directory = /website/sub/file.xhtml --- proxy as ---> /website/sub/file.xhtml -> Version Latest: directory = /website/sub/file.xhtml --- proxy as ---> /sub/file.xhtml -> Version Latest: directory = /website/website/sub/file.xhtml -- proxy as --> /website/sub/file.xhtml

Is it posible that something has changed between versions?

Regards,