FusionAuth with haproxy
-
Hi Guys,
I am new to FusionAuth and i need some help. Can i use FusionAuth tool with haproxy? For example, i have two application running ( say for Grafana and one web page in nginx) . I have one haproxy server also. So haproxy is configured like, when i browse haproxy IP/grafana => it will open Grafana application and when i will browse haproxy IP/nginx => it will open my web page. So i want like, i want to install and configure FusionAuth such a way, when i will try to open my any of application, it will first show FusionAuth login page and once authentication done - it will open my application. is it possible? -
I'm not familiar with HAProxy's configuration, but there's no reason you couldn't do this with some of the other proxy's I've used, so I'm hopeful.
You'll want to create two applications in FA and specify the redirect to be different for each one (say https://server/grafana and https://server/nginx). Then when a request is sent to your server, you'll want to check for a cookie: https://serverfault.com/questions/228823/haproxy-check-if-cookie-is-set . If that cookie isn't set, send them to FA. If it is, send them on to the application they requested.
FA sets a couple of cookies on successful authentication, depending on the method you are authenticating, though these are undocumented. If you'd like the ability to be able to set a specific cookie on authentication for this use case, please open a github issue: https://github.com/fusionauth/fusionauth-issues/issues
-
Thanks for your reply. Can you please let me know full code or command? i am fully new to this, and my client has given requirement.
-
I'm sorry, I can't provide a full working solution as that would require a fair bit of time to set up the environment, learn HAProxy and test it out.
If you'd like to discuss professional services, please let us know.
Here's more information about that option: https://fusionauth.io/community/forum/topic/51/i-need-feature-abc-and-am-willing-to-pay-you-to-build-it-how-can-i-get-in-touch
-
Hey there! I just configured haproxy to pass traffic to fusionauth today! Everything is working hokey pokey!
-
Here's a contrib project where community members have added proxy configs: https://github.com/FusionAuth/fusionauth-contrib