Skip to content

Condiontally homepage redirect based on domain and logged in status #12147

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

Merged
merged 1 commit into from
May 6, 2025

Conversation

humitos
Copy link
Member

@humitos humitos commented Apr 30, 2025

@humitos humitos requested a review from agjohnson April 30, 2025 09:38
@humitos humitos requested a review from a team as a code owner April 30, 2025 09:38
@humitos humitos requested a review from ericholscher April 30, 2025 09:38
Comment on lines +59 to +60
if request.user.is_authenticated:
return redirect("projects_dashboard")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? I mean, how do we check if the user is logged in under app.readthedocs.org if they are hitting readthedocs.org? cc @agjohnson

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, with no web instances anymore, and only instances set up with a production domain of app.readthedocs.org, those instances are likely going to handle requests for readthedocs.org as a project custom domain through proxito.

So I'm guessing this approach won't work, but I'd still test this to make sure.

But we probably needed the web ASG, with instances listening for the domain readthedocs.org, to support doing anything dynamic with requests to the old domain.

If this does work, any redirect() probably should have an explicit domain.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app.readthedocs.org and readthedocs.org will hit web-ext-theme proxito instances. I understand that to check if the user is logged in or not, the setting SESSION_COOKIE_DOMAIN and SESSION_COOKIE_NAME are used and on both requests they will have the same values -- so, I think this should work as expected.

@humitos
Copy link
Member Author

humitos commented May 6, 2025

I'm going to merge this PR now so we can deploy it today. @agjohnson I would still appreciate any feedback you may have here. It won't have any effect without changing the CF redirect, tho. We can test it that way 👍🏼

@humitos humitos merged commit c9df70b into main May 6, 2025
5 of 6 checks passed
@humitos humitos deleted the humitos/homepage-redirect branch May 6, 2025 11:05
@agjohnson
Copy link
Contributor

I didn't have any other notes here, the change looked good besides my question on request flow

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

Successfully merging this pull request may close these issues.

2 participants