TheStanfordDaily / stanforddaily

The Stanford Daily website frontend is proudly powered by Expo.
https://www.stanforddaily.com/
Apache License 2.0
59 stars 8 forks source link

Don't redirect errors to /wp-json/ #126

Closed epicfaace closed 4 years ago

epicfaace commented 4 years ago

Reasons for making this change

Previously, we had redirected all errors on the stanford daily page to https://wp.stanforddaily.com/wp-json/. This is because in order for the REST API to work, we need to redirect all paths from https://stanforddaily.com/wp-json/... to their corresponding https://wp.stanforddaily.com/wp-json/... paths.

However, this caused issues because when there was just an error on the page with rendering an article (which has nothing to do with the REST API), it would also redirect to /wp-json/ and become cached, so users would commonly just see code when going to our site.

This PR changes that approach by:

Testing

http://localhost:3000/wp-json/tsd/json/v1/tag/coronavirus/1 should redirect to https://wp.stanforddaily.com/wp-json/tsd/json/v1/tag/coronavirus/1.