From: <php...@li...> - 2010-08-05 23:43:03
|
On Fri, Aug 6, 2010 at 5:33 AM, Mingfai <min...@gm...> wrote: > hi, > > *Problem* > I noticed a difference the $_SERVER['REQUEST_URI'] in PHP between a native > php environment and in Java Bridge. In my test, I have a /test/index.php > with the following line: > <?php echo $_SERVER['REQUEST_URI']?> > > > Other than REQUEST_URI, I notice HTTP_POST also caused a problem. The current JavaBridge set the HTTP_POST with: env.environment.put("HTTP_HOST", env.environment.get("SERVER_NAME") + ":" + env.environment.get("SERVER_PORT")); For port 80, it includes the port number. The actually variable is sth like acme.com:80 , but in Apache/Nginx, HTTP_HOST won't show the port number when the port is 80. Because Wordpress does url checking as a string, a slight different results in a redirection. e.g. when the first request is http://acme.com/index.php, wordpress' canonical.php redirect_canonical() will re-construct a request_url with schema ("http://" or https://") . HTTP_HOST . REQUEST_URI. The reconstructed url will becomes http://acme.com:80/index.php. As the reconstructed uri doesn't match the request url which is http://acme.com/index.php, it will make a redirect to the "correct" url without the port number. After redirected, JavaBridge appended the :80 again, and WP thinks it is wrong again and keep redirecting. For this case, I think JavaBridge should match the standard way to set variable like Apache and Nginx, i.e. not to include the port number for port 80 request. With both REQUEST_URI and HTTP_HOST fixed, I'm able to run Wordpress with JavaBridge. regards, mingfai |