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

Add redirect to domain name #359

Open
kevinrobinson opened this issue Apr 11, 2018 · 5 comments
Open

Add redirect to domain name #359

kevinrobinson opened this issue Apr 11, 2018 · 5 comments

Comments

@kevinrobinson
Copy link
Contributor

Because the domain is used in querying for data, you can access different data based on the domain that's used for the learner experience or the researcher experience.

We should probably start redirecting everything to https://teachermoments.teachingsystemslab.org/ to make this simpler going forward. We could also update the query for researcher data to not care about the specific domain (just the path part of the URL).

FWIW @keving17 I ran into this just now, trying to use https://teachermoments.teachingsystemslab.org/ for data entered at the herokuapp domain. :)

@keving17
Copy link
Contributor

Hmmm. so I dont really have a good intuition on which approach would be better for this. Both approaches seem relatively easy.

We have the two different domains for research and teaching uses, right? Is this important?

@kevinrobinson
Copy link
Contributor Author

@keving17 Yep, I think both steps would be good - add redirection on the server so that if the domian isn't teachermoments.teachingsystemslab.org it redirects to that domain. That simplifies things going forward. And updating the query for researcher data so that it doesn't look at the domain name will make that work retroactively for past data.

I don't think having separately domains was intentional, it's just historical from before we had our own domain, and people still using older links.

@keving17
Copy link
Contributor

Hmmm. So I'm working on getting rid of the domain in the queries right now and I can't figure out how to work around string manipulation. From what I can see, the correct way to do the psql query for partial matches is

SELECT * FROM access where url LIKE '%/teachermoments/turner?WWA04062018'

but I can't seem to add the % character to the location variable

Also, how exactly does the redirect work? I don't see anything that seems relevant in index.js

@keving17
Copy link
Contributor

keving17 commented Jun 1, 2018

@kevinrobinson any ideas here?

@kevinrobinson
Copy link
Contributor Author

kevinrobinson commented Jun 3, 2018

@keving17 For querying, this may be helpful to check out: https://stackoverflow.com/questions/19471756/how-to-make-a-like-search-in-postgresql-and-node-js.

For the redirect, grep for https in https://github.com/mit-teaching-systems-lab/threeflows/blob/master/server/index.js and see how it's redirecting from http to https. We could do something similar where if the domain doesn't match ENV['CANONICAL_DOMAIN'] (eg, teachermoments.teachingsystemslab.org) then we redirect to that domain plus the request's path (eg, teachermoments.teachingsystemslab.org/${request.path} or something like that).

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

2 participants