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

API calls to .json URL are detected as static assets #8

Open
pi0 opened this issue Mar 29, 2018 · 2 comments
Open

API calls to .json URL are detected as static assets #8

pi0 opened this issue Mar 29, 2018 · 2 comments

Comments

@pi0
Copy link

pi0 commented Mar 29, 2018

Hey @davideast. Thanks for this great project. We use hnpwa-api (with a caching proxy on top of it) for nuxt/hackernews. Everything is fine and smooth. The only problem is that almost all website testers including webpagetest and PageSpeed Insights detect API calls to URLs ending with .json as static asset thus reducing final points even when adding cache headers!

image

I wonder if is it possible to make changes to provide URLs without .json extension or not? We can do such rewrites for nuxt-hackernews only but I think it may be useful for others too.


Deployed versions:

SSR: https://hn.nuxtjs.org
SPA: https://hn-spa.nuxtjs.org

@davideast
Copy link
Owner

Hey @pi0! Thanks for the kind words, and thank you for Nuxt!

This is definitely possible through the firebase.json configuration. There's a few solutions here. I can make a change to the API, although it would be a breaking change to the v0 API. Or, if you're hosting your own server, you can re-write the .json calls to use "cleanUrls" so there's no extension.

Are you hosting your own API or using the HNPWA API at https://api.hnpwa.com/v0/news/2.json?

@pi0
Copy link
Author

pi0 commented Apr 3, 2018

Thanks, David for the answer. I'm proxy-passing requests down to the to the api.hnpwa.com and for sure both rewriting URLs and hosting are perfect ideas.

BTW for the change, Can't we add more routes without .json extension to the /v0`?

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