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

HTTPS Redirect Issue while SSO Url is embedded in iFrame #406

Closed
prasanna10021991 opened this issue Dec 16, 2019 · 13 comments
Closed

HTTPS Redirect Issue while SSO Url is embedded in iFrame #406

prasanna10021991 opened this issue Dec 16, 2019 · 13 comments

Comments

@prasanna10021991
Copy link

prasanna10021991 commented Dec 16, 2019

The FusionAuth SSO server returning an HTTP response instead of an HTTPS response during a SAML request

Description

Fusion auth is giving me the response in http for the SAML request even though my request was

MicrosoftTeams-image

This causes the page which authenticates using the SAML request to be blocked as the browser identifies it as a page loading mixed content.

The nginx server on which the fusionauth app is hosted, returns proper 301 redirects with http requests upgraded to https but only fails on this fusionAuth authorize requests.

Upon enforcing a nginx conf change to redirect all http to https, the issue is temporarily handled in few browsers like chrome and firefox, but still fails in safari and ios versions of chrome and safari.

There is something odd that is happening with these versions of browsers as the SAML request keeps getting repeated in a loop and never stops thereby not loading the page in this instance too.
Screenshot 2019-12-13 at 5 43 14 PM

Steps to reproduce

Steps to reproduce the behavior:

  1. Embed the page which authenticates with FusionAuth IDP in an iFrame
  2. On load of the iFrame the URL embedded will initiate a SAML request in the background to the configured FusionAith IDP
  3. FusionAuth returns http URL in response instead of https
  4. Page stops loading as it is blocked by the browser for trying to load mixed content

Expected behavior

Response from FusionAuth server to be https url instead of http url

Platform

  • Device: [Desktop, iPhone X, iphone 7, etc]
  • OS: [e.g. iOS, macOS, Windows 10]
  • Browser [ safari 13+, chrome in iOS, firefox in iOS ]

Screenshots

Screenshot 2019-12-13 at 1 02 33 PM

Screenshot 2019-12-13 at 12 58 51 PM

@prasanna10021991
Copy link
Author

prasanna10021991 commented Dec 16, 2019

@robotdan , @jerryhopper .. I've raised a bug as suggested, to identify the source of this issue and if there can be any suggested workarounds to immediately get this working. I've tried upgrading requests by setting Content Security Policy and also as mentioned nginx conf..Both only work on chrome and firefox of desktops. Safari and other iOS devices have problem loading the page in all browsers. Could you please help me with this issue.

@robotdan
Copy link
Member

Ensure your proxy is adding the appropriate X-Forwarded-Proto header.

@prasanna10021991
Copy link
Author

@robotdan ..yes that is added in already, coz when we remove that we get a notification on the fusion auth admin portal.

@robotdan
Copy link
Member

  1. What is your configured redirect URL in your Application --> SAML configuration?
  2. Can you enable debug in your SAML configuration (Application --> SAML configuration) and then see what the Debug Event logs show.
  3. What is the value in the Location header in your first screenshot? You can remove the host, I'm looking for the path value.

@prasanna10021991
Copy link
Author

prasanna10021991 commented Dec 17, 2019

  1. What is your configured redirect URL in your Application --> SAML configuration?

Screenshot 2019-12-17 at 10 46 41 AM

Screenshot 2019-12-17 at 10 45 46 AM

  1. Can you enable debug in your SAML configuration (Application --> SAML configuration) and then see what the Debug Event logs show.

Yes, I'm getting the SAML request, but response is not being sent back. The request seems to be fine:
Screenshot 2019-12-17 at 11 09 43 AM

Screenshot 2019-12-17 at 11 08 15 AM

  1. What is the value in the Location header in your first screenshot? You can remove the host, I'm looking for the path value.

Path Value:
http://dev.sso/oauth2/authorize?client_id=be04d618-b2bd-4ecd-88ac-69959d548347&redirect_uri=%2Fsamlv2%2Fcallback%2F4d30cc31-ea5c-f9c7-9ace-d7da9994ebea&response_type=code&state=%7B%22ai%22%3A%22be04d618-b2bd-4ecd-88ac-69959d548347%22%2C%22id%22%3A%22id_bab47b32%22%7D

Screenshot 2019-12-17 at 11 11 45 AM

@robotdan
Copy link
Member

These seems likely an issue with your proxy configuration. I am not an nginx expert, but if you post your config I may be able to review it.

@prasanna10021991
Copy link
Author

Will send it out as soon as I get the info from the Devops team Dan. Thanks a ton

@JesperWe
Copy link

JesperWe commented Jan 6, 2020

I had the exact same issue. @prasanna10021991 's suggested solution to add

proxy_redirect http:// https://;

solved the problem for me.

So apparently the X-Forwarded-Proto header which resolves other redirect issues was not enough for this particular function, which seems kind of strange.

@prasanna10021991
Copy link
Author

prasanna10021991 commented Jan 6, 2020

@robotdan ..Is this something we're missing on our end in nginx configurations, or something's getting missed out during the communication with FusionAuth as the urls being sent out become http instead of https.

@robotdan
Copy link
Member

robotdan commented Jan 6, 2020

@prasanna10021991 When we build a redirect URI we prefer the value provided in the X-Forwarded-Proto header, if that is not present then we use the schema on the servlet request.

I don't know a lot about NGINX proxy config, perhaps they don't always add the X-Forwarded-Proto header based upon the configuration.

@jlusky
Copy link

jlusky commented Jul 10, 2020

X-Forwarded- headers aren't working at all for me with nginx. And I've confirmed with wireshark that nginx is really adding them. I see these headers and broken redirect when I do curl https://login.mydomain.com:

tshark -V -i lo port 9011 | egrep 'X|ocation:|Host:'
Running as user "root" and group "root". This could be dangerous.
Capturing on 'Loopback'
X-Forwarded-Proto: https\r\n
X-Forwarded-Host: login.mydomain.com\r\n
X-Forwarded-Port: 443\r\n
X-Forwarded-For: 104.7.123.123\r\n
Location: http://localhost:9011/login\r\n

@jlusky
Copy link

jlusky commented Jul 10, 2020

The workaround for me in nginx is these two lines:
proxy_set_header Host "login.mydomain.com";
proxy_redirect http:// https://;

This doesn't actually fix FusionAuth, it just makes nginx rewrite the broken Location header from FusionAuth.

@robotdan
Copy link
Member

robotdan commented Nov 6, 2023

Please re-open if you believe there is still a bug in FusionAuth causing this issue.

@robotdan robotdan closed this as completed Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants