Access web based applications using an alias instead of a port
-
I have a few apps, some are python based, while other are .NET based. They all start by running an executable. They simply have a web frontend as opposed to a "regular" application GUI. Since they're running as a Windows process, I can't really point to a web directory (/www/htdocs/).
-
How are the web front ends rendered? They have to be somewhere that's accessing by the webserver, unless they do their own serving outside the webserver. In that case, put all the frontends in separate directories using virtual hosts, and point them to their required executables. Which is bad, but that's another story. If they do their own serving then this rules out my suggestions.
-
If http://<server>:8081/app1/ does 'work' then you must make sure that the httpchk also uses that url to perform the checks fill in the 'Http check URI' with '/app1/'</server>
-
Oops I missed that sentence :) So everything works now! I'm getting a good health check. The issue though is that when I go to http://app1, it takes me to http://<server>:<port>, instead of http://<server>:<port>/app1. Where can I add the /app1 part?</port></server></port></server>
-
Hope this helps, put the code in the 'Backend pass thru':
Code to change a request from / to /app1/
reqirep ^([^\ :]*)\ /(.*) \1\ /app1/\2
If urls in the response contain absolute urls it might be required to use this:
acl no_redir url_beg /app1/ reqirep ^([^\ :]*)\ /(.*) \1\ /app1/\2 if !no_redir
The code makes sure that the method and url-path behind the / stays the same. Which method you need exactly might depend on the application thats running.
For readability of the above how change a request from /app1/ to /app1/app1redir/reqirep ^([^\ :]*)\ /app1/(.*) \1\ /app1/app1redir/\2
If those above dont work you might still be able to get a acceptable workaround by using a redirect:
acl no_redir url_beg /app1/ http-request redirect location http://%[req.hdr(Host)]/app1/ if !no_redir
Actually most of this info can be found in the manual, have you seen it?: http://cbonte.github.io/haproxy-dconv/configuration-1.5.html
-
Everything works great! Thank you so much for all your help!