Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create any resources in admin behind a HA Proxy #112

Closed
davidb-e4s opened this issue Apr 10, 2019 · 7 comments
Closed

Can't create any resources in admin behind a HA Proxy #112

davidb-e4s opened this issue Apr 10, 2019 · 7 comments
Assignees
Labels
support Further information is requested or user requires assistance

Comments

@davidb-e4s
Copy link

davidb-e4s commented Apr 10, 2019

Can't create any resources in admin behind a HA Proxy

Description

I've put the FA service behind a HA reverse proxy with SSL termination. I can login to the console and view everything but as soon as I try to create a tenant/user anything it says I don't have permission to do it (even though I'm admin). It works if I access the box directly.

This sort of thing is normally header related what headers do I need to provide. Note FA is still operating over HTTP behind the proxy.

@robotdan
Copy link
Member

The symptom you describe sounds like your browser is not session pinned to a particular node. When you place FusionAuth behind a proxy, you'll need to session pin based upon the URL path.

In the Two Servers section of the server layout guide, the session pinning strategy is outlined.
https://fusionauth.io/docs/v1/tech/installation-guide/server-layout

In this scenario FusionAuth should be placed behind a load balancer to utilize both services equally. Session pinning should be utilized to support stateful sessions to FusionAuth. API connections to the FusionAuth App are stateless and do not require session pinning. All URLs beginning with /api/ will be API requests and should not be session pinned.

What type of proxy are you using?

@robotdan robotdan self-assigned this Apr 10, 2019
@robotdan robotdan added the support Further information is requested or user requires assistance label Apr 10, 2019
@davidb-e4s
Copy link
Author

Hey,

Well I'm only running 1 instance of FA at the moment so it will always go to the same one.

We're using HA Proxy

@robotdan
Copy link
Member

Ah, ok good to know. Ok, my second guess will be better.

It sounds like you're only seeing this when you submit a form. During POST requests we perform CSRF validation. To ensure you pass this validation, ensure the following:

  • The Origin HTTP header is being set by the proxy, or as a fallback we'll also use the Referer header.
  • The X-Forwarded-Proto header is set to ensure that FusionAuth knows the incoming request was https even though behind the SSL termination it will be http.
  • The X-Forwarded-Host header is set if this changes from a DNS name to a localhost (for example) behind the proxy
  • The X-Forwarded-Port is set using non-standard parts such as 80 or 443.

If all of those are true, FusionAuth should be able to detect the correct URL and compare that to the Origin or Referer header to ensure the request is not malicious.

My guess is that you're missing the X-Forwarded- headers. This guide may be useful.
https://www.digitalocean.com/community/tutorials/how-to-implement-ssl-termination-with-haproxy-on-ubuntu-14-04

@robotdan
Copy link
Member

@davidb-e4s were you able to get past this issue by adding these X-Forwarded- headers?

@davidb-e4s
Copy link
Author

davidb-e4s commented Apr 12, 2019 via email

@davidb-e4s
Copy link
Author

Hi Dan,

Just an update I've been swamped but hoping to look at this early this week.

Thanks

@robotdan
Copy link
Member

Thanks for the update @davidb-e4s , let us know if you run into issues. In version 1.6.0 you should see a large warning on the dashboard page if the we detect X-Forwarded- headers are necessary and are missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Further information is requested or user requires assistance
Projects
None yet
Development

No branches or pull requests

2 participants