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

Accept locale parameter for /schema #133

Open
dstillman opened this issue Apr 3, 2023 · 1 comment
Open

Accept locale parameter for /schema #133

dstillman opened this issue Apr 3, 2023 · 1 comment
Assignees

Comments

@dstillman
Copy link
Member

dstillman commented Apr 3, 2023

And don't return the other locales, to reduce data transfer for web-library and zbib

  1. Replace scripts/update-gz in https://github.com/zotero/zotero-schema/ with a (Python?) script that pre-generates a whole bunch of gzipped files, one for each locale
  2. Add a hard-coded list of known locales in .htaccess, falling back to the full file
@dstillman
Copy link
Member Author

dstillman commented May 1, 2023

#
# Serve pre-compressed schema file from zotero-schema submodule
#
# https://httpd.apache.org/docs/2.4/mod/mod_deflate.html#precompressed
#
RewriteCond "%{HTTP:Accept-Encoding}" "gzip"
RewriteRule ^schema$ zotero-schema/schema.json.gz [QSA]
# Serve correct content type, and prevent mod_deflate double gzip.
RewriteRule ^zotero-schema/schema\.json.gz$ - [T=application/json,E=no-gzip:1]
<Files schema.json.gz>
# Serve correct encoding type
Header append Content-Encoding gzip
# Force proxies to cache gzipped & non-gzipped schema file separately
Header append Vary Accept-Encoding
# CORS
Header set Access-Control-Allow-Origin "*"
</Files>

We only make gzipped requests from our own software (and if we notice someone else not doing that, we should probably tell them to), so we probably don't need to worry about the locale parameter for non-gzipped requests — it can just return the regular JSON file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants