Reputation: 62
I created an app that you can view for context: fitsked.net. When registering on a laptop, the registration works fine. When registering on mobile (Chrome or Safari), the registration fails. Pause. The thing that actually isn't working is the registration confirmation. I know this because, when clicking "register" on mobile, the user registration data gets saved into the database. However, as you can see for yourself, the mobile version will direct you back to the home page instead of the "confirm account" page seen when registering on a laptop. Since you can't confirm your account on mobile, you can't login. Don't worry about the UX, I know this way of confirming an account is terrible.
When using Developer Tools on my laptop and choosing "iPhone SE" dimension or similar, the registration works. It doesn't work on iOS hardware - it doesn't work on Android hardware. I've verified on both. I swore this was at some point working during development. I can go back through my commits and see if it was ever working through trial and error, but would much rather just track down the actual problem.
I added logging to the app so that it would show up on the logs of my EC2 instance. As you can see, there is supposed to be a redirection to "Account/RegisterConfirmation." The following snippet is located in the app's Register.razor page.
if (UserManager.Options.SignIn.RequireConfirmedAccount)
{
Logger.LogInformation("RequireConfirmedAccount must have been true. Did you use a laptop to login?");
RedirectManager.RedirectTo(
"Account/RegisterConfirmation",
new() { ["email"] = Input.Email, ["returnUrl"] = ReturnUrl });
}
else
{
Logger.LogInformation("RequireConfirmedAccount must have been false. Did you just try to register with iPhone?");
}
I figured this method wasn't being called when registering from my phone. That's not the case. When registering on both my phone and laptop, I get "RequireConfirmedAccount must have been true. Did you use a laptop to login?" Therefore, I'm thinking it's got to be something with RedirectManager. Ultimately, I guess there must be like a fall back to the Home page for when the Account/RegisterConfirmation page is blocked?
Lastly, I've tried to track down the issue on iPhone by connecting it to my MacBook through the USB cable. This way I can use Developer Tools for Safari on the iPhone. I've looked at Console tab for errors and Network tab for any other routing-related errors. Am I looking in the right place? Any direction? Any suggestions on how I could debug something like this in the cloud using breakpoints? Thank you.
Upvotes: 0
Views: 38
Reputation: 22082
Since the issue occurs in apple device, then I try to download the safari browser or something. Finally I found below browser(I know it's not safari) in Microsoft Store, and it can reproduce the issue.
Here is the http trace for you.
We can see the https
post request was sent, but we find http
in response header, this is the main issue.
Then I copy the url, and access it in desktop browser(no device requirement) directly, then we can reproduce the issue easily.
http://fitsked.net/Account/[email protected]
And use https
test again, it works normally.
https://fitsked.net/Account/[email protected]
All symptoms indicate that this issue is related to app.UseHttpsRedirection();
middleware, please make sure to use it and make sure the middleware order is correct first.
Then we should check the logic in /Account/Register
, why it tell browser to access http://
location.
Upvotes: 1