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

feat: add configurable redirect #142

Merged
merged 2 commits into from
Mar 7, 2023
Merged

Conversation

vasco-santos
Copy link
Contributor

@vasco-santos vasco-santos commented Mar 3, 2023

Adds configurable redirect via a secret that can easily be deployed and removed if needed. Later on, we can decide to remove the race code

Also made github actions use Node 16 because apparently it started installing Node18 now and we require Node16 https://github.com/web3-storage/reads/blob/main/package.json#L46 . In follow up PR I will also update to Node18

Closes #141

@vasco-santos vasco-santos force-pushed the feat/add-configurable-redirect branch 5 times, most recently from 0ece497 to 6cab40f Compare March 3, 2023 10:53
@vasco-santos vasco-santos force-pushed the feat/add-configurable-redirect branch from 6cab40f to 7dfd4c7 Compare March 3, 2023 15:17
@vasco-santos
Copy link
Contributor Author

@alanshaw @olizilla per what we talked about earlier today, just made sure and in grafana we track status code https://daghouse.grafana.net/d/PCqBFbzVz/w3link?orgId=1 . So, we will already be able to see the amount of traffic that is not served by Cache + Freeway and is redirected. So, we don't really need any action in this PR for metrics :)

Copy link
Member

@alanshaw alanshaw left a comment

Choose a reason for hiding this comment

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

Code changes LGTM, but I think the status code needs to change...

`https://${cid}.ipfs.${env.ipfsGatewayRedirectHostname}${pathname}${search}`
)

return Response.redirect(url.toString(), 303)
Copy link
Member

Choose a reason for hiding this comment

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

[303] indicates that the redirects don't link to the requested resource itself, but to another page (such as a confirmation page, a representation of a real-world object — see HTTP range-14 — or an upload-progress page). This response code is often sent back as a result of PUT or POST. The method used to display this redirected page is always GET.

Maybe we want https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307 instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@olizilla 's proposal was 303 https://hackmd.io/@olizilla/w3s-redirect . So, would like to get input if there was something that made 303 the suggestion.

For the documentation, I agree that 307 seems more appropriate

Copy link
Contributor

Choose a reason for hiding this comment

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

yep, agree, 307 sounds closer to what we want. I didn't realise that "303 See other" implied we were linking to a different resource.

@vasco-santos vasco-santos merged commit cfb8798 into main Mar 7, 2023
@vasco-santos vasco-santos deleted the feat/add-configurable-redirect branch March 7, 2023 08:42
vasco-santos pushed a commit that referenced this pull request Mar 7, 2023
🤖 I have created a release *beep* *boop*
---


##
[1.10.0](edge-gateway-v1.9.3...edge-gateway-v1.10.0)
(2023-03-07)


### Features

* add configurable redirect
([#142](#142))
([cfb8798](cfb8798)),
closes [#141](#141)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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 to dweb.link
3 participants