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

Change app gateway to redirect self-registration links to /app #3344

Merged
merged 3 commits into from
Feb 8, 2022

Conversation

nickclyde
Copy link
Member

Related Issue or Background Info

  • When Upgrade react-router to v6 #3261 was merged, a bug was discovered where self registration links (/register/foo) would render a blank white page. Our app gateway is currently configured to catch any /register/* requests and rewrite them as /app/register/*. React router v5 seemed to handle this just fine, but v6 does not. We can alter the app to pass out links prefixed with /app, but we need to support the old links too in case orgs have them saved outside of the app. One way to support this is to change the configuration of our app gateway to redirect /register/* requests to /app/register/* instead of rewriting.

Changes Proposed

  • change the configuration of our app gateway to redirect /register/* requests to /app/register/* instead of rewriting.

Additional Information

  • I already made this change in the Azure console for our dev gateway and confirmed that it works with router v6!

Screenshots / Demos

Checklist for Author and Reviewer

Infrastructure

  • Consult the results of the terraform-plan job inside the "Terraform Checks" workflow run for this PR. Confirm that there are no unexpected changes!

Design

  • Any UI/UX changes have a designer as a reviewer, and changes have been approved
  • Any large-scale changes have been deployed to test, dev, or pentest and smoke-tested by both the engineering and design teams

Content

  • Any content changes (including new error messages) have been approved by content team

Support

  • Any changes that might generate new support requests have been flagged to the support team
  • Any changes to support infrastructure have been demo'd to support team

Testing

  • Includes a summary of what a code reviewer should verify

Changes are Backwards Compatible

  • Database changes are submitted as a separate PR
    • Any new tables that do not contain PII are accompanied by a GRANT SELECT to the no-PHI user
    • Any changes to tables that have custom no-PHI views are accompanied by changes to those views
      (including re-granting permission to the no-PHI user if need be)
    • Liquibase rollback has been tested locally using ./gradlew liquibaseRollbackSQL or liquibaseRollback
    • Each new changeset has a corresponding tag
  • GraphQL schema changes are backward compatible with older version of the front-end

Security

  • Changes with security implications have been approved by a security engineer (changes to authentication, encryption, handling of PII, etc.)
  • Any dependencies introduced have been vetted and discussed

Cloud

  • DevOps team has been notified if PR requires ops support
  • If there are changes that cannot be tested locally, this has been deployed to our Azure test, dev, or pentest environment for verification

@rin-skylight
Copy link
Collaborator

@nickclyde Have you tried rolling this out via a deploy to a lower environment? I'm not seeing your change reflected in the output of terraform plan, and want to make sure it's doing what you want it to before we merge this.

@nickclyde
Copy link
Member Author

I actually manually made the changes in the Azure portal on the dev gateway but I haven't tried it through terraform. I do see it in the plan output here though. If I deploy this branch to dev, will terraform apply the changes only to the dev gateway?

@jdorothy
Copy link
Collaborator

jdorothy commented Feb 3, 2022

I actually manually made the changes in the Azure portal on the dev gateway but I haven't tried it through terraform. I do see it in the plan output here though. If I deploy this branch to dev, will terraform apply the changes only to the dev gateway?

Yep! TF is part of a deploy, so your changes will be applied in dev.

@nickclyde nickclyde temporarily deployed to Dev February 3, 2022 22:42 Inactive
@nickclyde
Copy link
Member Author

nickclyde commented Feb 3, 2022

It works on dev!! Check it out: https://dev.simplereport.gov/register/E8Q2P

image

I did have a question about the env naming though. If merged as is, the redirect in prod will point at https://prod.simplereport.gov/app instead of https://simplereport.gov/app. Do we have an existing pattern somewhere in TF for handling that difference, or should I just do a ternary like var.env == 'prod' ? "https://simplereport.gov/app" : "https://${var.env}.simplereport.gov/app"?

@jdorothy
Copy link
Collaborator

jdorothy commented Feb 3, 2022

It works on dev!! Check it out: https://dev.simplereport.gov/register/E8Q2P

Nice!

I did have a question about the env naming though. If merged as is, the redirect in prod will point at https://prod.simplereport.gov/app instead of https://simplereport.gov/app. Do we have an existing pattern somewhere in TF for handling that difference, or should I just do a ternary like var.env == 'prod' ? "https://simplereport.gov/app" : "https://${var.env}.simplereport.gov/app"?

As far as the ternary, that is, in fact, what we're doing elsewhere:

url_prefix = var.env == "prod" ? "www" : var.env

I still want to see if the rewrite rule provides some variables we can use but otherwise this is a reasonable way of doing it I think.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 4, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@rin-skylight
Copy link
Collaborator

I actually manually made the changes in the Azure portal on the dev gateway but I haven't tried it through terraform. I do see it in the plan output here though. If I deploy this branch to dev, will terraform apply the changes only to the dev gateway?

Ah, I missed that! Thank you for pointing it out, and for the test.

Copy link
Collaborator

@rin-skylight rin-skylight left a comment

Choose a reason for hiding this comment

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

Everything here looks good to me, and it looks like you were able to verify these changes with Josh. Again, thank you for taking this on!

@nickclyde nickclyde mentioned this pull request Feb 4, 2022
17 tasks
@nickclyde nickclyde merged commit 0d41592 into main Feb 8, 2022
@nickclyde nickclyde deleted the nick/redirect-self-reg-links branch February 8, 2022 00:23
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.

3 participants