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 302 redirects to env.EXTERNAL_GRAPHQL_URL #550

Merged
merged 3 commits into from
Jul 3, 2019

Conversation

cshepherd
Copy link
Contributor

Signed-off-by: Christopher Shepherd christopher@reactioncommerce.com

Resolves #549
Impact: minor
Type: feature

Issue

Adds 302 redirects for a few paths via express.js

Solution

Added redirects at the express.js level rather than the next.js router because I don't see a downside to it, and it's easy to express in just a few lines of code.

Breaking changes

none

Testing

  1. curl -i http://localhost:4000/graphiql (or /graphql, or /graphql-alpha or /graphql-beta)
  2. Observe HTTP 302 redirect to EXTERNAL_GRAPHQL_URL

Signed-off-by: Christopher Shepherd <christopher@reactioncommerce.com>
@cshepherd cshepherd requested a review from focusaurus July 2, 2019 18:13
Copy link
Contributor

@focusaurus focusaurus left a comment

Choose a reason for hiding this comment

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

LGTM! My only thought is maybe 301 MOVED PERMANENTLY is the more pedantic/correct code?

Christopher Shepherd added 2 commits July 2, 2019 14:21
Signed-off-by: Christopher Shepherd <christopher@reactioncommerce.com>
…t temporary

Signed-off-by: Christopher Shepherd <christopher@reactioncommerce.com>
@cshepherd
Copy link
Contributor Author

LGTM! My only thought is maybe 301 MOVED PERMANENTLY is the more pedantic/correct code?

The redirect is permanent and 301 is therefore correct, but browsers will cache a 301 as long as possible in the absence of a Cache-Control: header, and someday 'reaction/graphql-beta' will probably become 'reaction/graphql'. Perhaps 301 with "Cache-Control: max-age=86400" header? Or am I overthinking this?

@focusaurus focusaurus merged commit ae6674a into develop Jul 3, 2019
@focusaurus focusaurus deleted the feature_redirect_graphiql branch July 3, 2019 17:54
@kieckhafer kieckhafer mentioned this pull request Aug 2, 2019
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.

Redirect graphql playground (graphiql) to core
2 participants