File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,6 +112,35 @@ server {
112112 return 429 '{"status": 429, "message": "Too Many Requests. Consider using https://openlibrary.org/developers/dumps."}';
113113 }
114114
115+ location /opds/ {
116+ proxy_pass https://ol-opds.prod.archive.org/;
117+
118+ add_header Access-Control-Allow-Origin "*" always;
119+ add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
120+ add_header Access-Control-Allow-Headers "Content-Type, Authorization" always;
121+
122+ # Handle preflight
123+ if ($request_method = OPTIONS) {
124+ return 204;
125+ }
126+
127+ add_header X-OPDS-Backend "ol-opds.prod.archive.org" always;
128+ proxy_ssl_server_name on;
129+ proxy_set_header Host ol-opds.prod.archive.org;
130+ proxy_set_header X-Forwarded-For $remote_addr;
131+ proxy_set_header X-Forwarded-Proto $scheme;
132+
133+ # optional but usually needed
134+ proxy_redirect off;
135+ }
136+
137+ location = /opds {
138+ add_header Access-Control-Allow-Origin "*" always;
139+ add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
140+ add_header Access-Control-Allow-Headers "Content-Type" always;
141+ return 308 /opds/;
142+ }
143+
115144 location / {
116145 limit_req zone=web_limit burst=100 delay=10;
117146 limit_req zone=ua_rate_limit burst=25 delay=10;
You can’t perform that action at this time.
0 commit comments