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: organize proxy routes #13

Merged
merged 4 commits into from
May 2, 2024
Merged

feat: organize proxy routes #13

merged 4 commits into from
May 2, 2024

Conversation

alfetopito
Copy link
Contributor

@alfetopito alfetopito commented May 2, 2024

Summary

As suggested on #10 (review)

Move path coingeckoProxy to proxies/coingecko

And to match the pattern, also moved proxy to proxies/tokens

Kept the old proxy to not break existing consumers. To be removed at a later date.
I did add a permanent redirect, but graphql-request is not capable of following it.
It would essentially break existing consumers.

Testing

  1. Replace usage of coingeckoProxy with https://cow-web-services-git-feat-organize-proxy-routes-cowswap.vercel.app/proxies/coingecko
  • Should work as before
  1. Replace usage of proxy with https://cow-web-services-git-feat-organize-proxy-routes-cowswap.vercel.app/proxies/tokens
  • Should work as before
  1. Replace usage of proxy with https://cow-web-services-git-feat-organize-proxy-routes-cowswap.vercel.app/proxy
  • Should work as before

Copy link

vercel bot commented May 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
cow-web-services ✅ Ready (Inspect) Visit Preview May 2, 2024 11:08am

…ath"

This reverts commit 246c27a.

graphql-request doesn't seem able to handle redirects natively:
https://stackoverflow.com/questions/78015439/follow-redirects-setting-for-aws-appsync#comment137542218_78015439

Thus, reverting the redirect change
@alfetopito alfetopito self-assigned this May 2, 2024
@alfetopito alfetopito marked this pull request as ready for review May 2, 2024 11:14
@alfetopito alfetopito merged commit 1261701 into main May 2, 2024
3 checks passed
@alfetopito alfetopito deleted the feat/organize-proxy-routes branch May 2, 2024 12:46
anxolin added a commit that referenced this pull request May 7, 2024
* feat: coingecko proxy (#10)

* feat: add coingeckoProxy

* chore: add fastify/caching dependency

* feat: add request caching

* fix: only cache successfull responses from proxy origin

* chore: improve logging

* feat: set our own cache-control header

* chore: delete set-cookie header

* chore: rename local header from cache-hit to x-proxy-cache and leave it in the reply

* Revert "chore: rename local header from cache-hit to x-proxy-cache and leave it in the reply"

This reverts commit 71ecd72.

* fix: prevent content-length header mismatch errors

* fix: do not fwd accept-encoding header, as I'm not able to deal with encoded response

* chore: attempt at caching only after response is sent

* chore: try a different way to decorate

* Revert "chore: try a different way to decorate"

This reverts commit 31672a6.

* Revert "chore: attempt at caching only after response is sent"

This reverts commit b2dd0eb.

* feat: coingecko proxy without server side caching (#11)

* feat: remove server side caching

* chore: remove fastify-caching

* chore: undici config still required

* fix: type on cdn-cache-control value

* feat: add coingecko api key (#12)

* feat: add coingecko api key to proxy requests

* fix: remove `simple` prefix as it's part of coingecko's path

* chore: temporarily change to pro-api since the key is set to "pro"

* chore: add COINGECKO_PROXY_UPSTREAM as optional env var

* feat: organize proxy routes (#13)

* refactor: move coingeckoProxy to proxies/coingecko

* refactor: move proxy to proxies/tokens and keep proxy for awhile

* chore: add permanent redirect rather than re-exporting same path

* Revert "chore: add permanent redirect rather than re-exporting same path"

This reverts commit 246c27a.

graphql-request doesn't seem able to handle redirects natively:
https://stackoverflow.com/questions/78015439/follow-redirects-setting-for-aws-appsync#comment137542218_78015439

Thus, reverting the redirect change

* fix: build and run

---------

Co-authored-by: Anxo Rodriguez <anxolin@gmail.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.

2 participants