topcoder-platform / community-app

React webapp for serving Topcoder Community
125 stars 214 forks source link

404 error when user accesses/privacy/terms-and-conditions through direct URL #6864

Closed jmgasper closed 1 year ago

jmgasper commented 1 year ago

REF: https://topcoder.atlassian.net/browse/PROD-4193

Bug:

when you go to https://www.topcoder.com/privacy and click on the Terms and Conditions link, it is working correctly and directs you to the T&Cs. However, when you copy and past the T&C url https://www.topcoder.com/privacy/terms-and-conditions into a new tab, it gives you an error

Investigation

Interestingly, we do redirect to the /privacy route. I tried /policy/terms-and-conditions and it still shows the same issue though.

        <Redirect
          exact
          from="/policy"
          to="/privacy"
        />

All the containers/PolicyPages.jsx container seems to do is load and display from Contentful.

        <Route
          component={PolicyPages}
          exact
          path={`${config.POLICY_PAGES_PATH}/:slug?`}
        />
suppermancool commented 1 year ago

@jmgasper I can not reproduce this locally. I think the problem is outside of the ca code(maybe some config in the service that deploys https://www.topcoder.com/ page does this)

You can see when open https://www.topcoder.com/privacy it first redirects to https://www.topcoder.com/policy then redirects back to https://www.topcoder.com/privacy

i think we can try to handle the url like https://www.topcoder.com/policy/terms-and-conditions in CA. That may work. Pls try this Patch file first: community-app-issue-6864-2.patch

This patch against commit ebfddf53eb5758585a4ea382674f1f6c5e43b3f5 in develop branch

suppermancool commented 1 year ago

@jmgasper if the above patch does not work I think we can try to change the URL of https://www.topcoder.com/privacy to something like https://www.topcoder.com/page-privacy. If this approach is valid pls try this Patch: community-app-issue-6864.patch (you need to discard above change first before applying this)

This patch against commit ebfddf53eb5758585a4ea382674f1f6c5e43b3f5 in develop branch

jmgasper commented 1 year ago

@suppermancool - I think that patch worked. I'm checking with QA now, thanks!

suppermancool commented 1 year ago

@jmgasper i just figured out a couple of things:

jmgasper commented 1 year ago

@suppermancool - Ok, thanks. I deployed your fix to https://staging-community-app.topcoder.com/privacy/terms-and-conditions and it seems to work.

suppermancool commented 1 year ago

@jmgasper I think this bug will not happen in https://staging-community-app.topcoder.com/ with or without my changes

When opening https://staging-community-app.topcoder.com/privacy i do not see weird redirects like https://www.topcoder-dev.com/privacy or https://www.topcoder.com/privacy

jmgasper commented 1 year ago

@suppermancool - Thanks for the pointer. I've investigated the Contentful setup and we're going to try something on that side later today.