Reputation: 2798
I have configured my AWS application load balancer to have the following rules:
/images/*
forward to server A (https://servera.com
)/videos/*
forward to server B (https://serverb.com
)And this is correctly forwarding to the respective servers. However, I don't want the load balancer to forward the request as https://servera.com/images
& https://serverb.com/videos
. I just want the respective servers to be hit without the path pattern as https://servera.com
& https://serverb.com
(without the path patterns in the request).
I don't want to modify my request parameters or change my server side code for this. Is there a way I can tell the application load balancer to not forward the path patterns?
Upvotes: 25
Views: 6545
Reputation: 178966
Is there a way I can tell the application load balancer to not forward the path patterns?
No, there isn't. It's using the pattern to match the request, but it doesn't modify the request.
I don't want to modify my request parameters or change my server side code for this.
You'll have to change something.
You shouldn't have to change your actual code. If you really need this behavior, you should be able to accomplish it using the web server configuration -- an internal path rewrite before the request is handed off to the application by the web server should be a relatively trivial reconfigurarion in Nginx, Apache, HAProxy, or whatever is actually listening on the instances.
Also, it seems to me that you are making things difficult on yourself by wanting the server to respond to a path different than what is requested by the browser. Such a configuration will tend to make it more difficult to ensure correct test results and correct handling of relative and absolute paths, since the applications will have an inaccurate internal representation of what the browser is requesting or will need to request.
Upvotes: 8