1

I have an apache load balancer with mod_proxy and wildfly (apache 224 and wildfly 9).

I have 4 servers in domain in wildfly and the load balancer works fine with a "hello world" app, and in the balancer manager i can see how the requests are sent to each server.

The thing is, When I use the app that has some REST web services, i am sending the request with a GET method and some headers for authentication, and somehow, the application is responding with error when i access it through the load balancer, but if I send it directly to the server, it works correctly.

my cofiguration goes as follows

<VirtualHost *:80>
ProxyRequests Off
<Proxy balancer://mycluster>
    BalancerMember http://localhost:8080/ loadfactor=25
    BalancerMember http://localhost:8230/ loadfactor=25
    BalancerMember http://localhost:8330/ loadfactor=25
    BalancerMember http://localhost:8430/ loadfactor=25
</Proxy>
<Location /balancer-manager>
    SetHandler balancer-manager
    Order Deny,Allow
    Allow from all
</Location> 
<Location /test>
    Order allow,deny
    Allow from all
</Location> 
ProxyPass /test balancer://mycluster stickysession=JSESSIONID

I am testing using postman and sending the requests with a get method and a header for authentication: basic {base64 code} as follows:

http://127.0.0.1/test/myproject.ws/myproject/get_list?key=T11108101191&page=1

and this results in error.

when i try this:

http://127.0.0.1:8080/myproject.ws/myproject/get_list?key=T11108101191&page=1

This goes ok

and when i try the above, but with a post method, it gets the same error as in the load balancer.

Any idea of what am i doing wrong?

PS: I've tried putting in the WEB-INF/web.xml of the project, but i still get the same error.

user3123488
  • 133
  • 10
  • Not sure if it is related but you should be consistent with trailing slashes, if using `ProxyPass /test`, then use `BalancerMember http://localhost:8080` – Dusan Bajic Aug 11 '16 at 20:38
  • 1
    Thanks! that was the problem. Iwas getting nuts about this as I saw everything that was good, and i had no error at all in logs. – user3123488 Aug 12 '16 at 15:35

1 Answers1

1

Thanks to Dusan Bajic, he saw the problem I had. In the balancer member i was finishing the route with "/" and when I used the ProxyPass, i was starting with "/", duplicating that character. Somehow, with the helloworld app it worked correctly, but when i pass parameters, it failed.

The new configuration goes as follows:

<VirtualHost *:80>
    ProxyRequests Off
<Proxy balancer://mycluster>
    BalancerMember http://localhost:8080 loadfactor=25
    BalancerMember http://localhost:8230 loadfactor=25
    BalancerMember http://localhost:8330 loadfactor=25
    BalancerMember http://localhost:8430 loadfactor=25
</Proxy>
<Location /balancer-manager>
    SetHandler balancer-manager
    Order Deny,Allow
    Allow from all
</Location> 
<Location /test>
    Order allow,deny
    Allow from all
</Location> 

ProxyPass /test balancer://mycluster stickysession=JSESSIONID
</VirtualHost>
user3123488
  • 133
  • 10