rm middleware log; add public api cache

master
adb-sh 2 years ago
parent 933e6a85b2
commit f87eb4dcdd

@ -9,6 +9,5 @@ export const auth = async (req, res, next) => {
res.send({ message: 'unauthorized' }); res.send({ message: 'unauthorized' });
return; return;
} }
console.log('middleware', res.locals.user, await res.locals.user.spotify.local);
next(); next();
}; };

@ -20,6 +20,7 @@ http {
# tcp_nodelay on; # tcp_nodelay on;
# gzip on; # gzip on;
client_max_body_size 1m; client_max_body_size 1m;
proxy_cache_path ./cache/ keys_zone=public_api_cache:1m;
server { server {
listen 8080 default_server; listen 8080 default_server;
@ -83,6 +84,18 @@ http {
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
} }
location /api/public {
add_header "Access-Control-Allow-Origin" *;
add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD, DELETE";
add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
add_header X-Cache-Status $upstream_cache_status;
proxy_cache public_api_cache;
proxy_cache_valid 200 8s;
default_type application/json;
proxy_pass http://backend:3000;
}
location /api { location /api {
default_type application/json; default_type application/json;
proxy_pass http://backend:3000; proxy_pass http://backend:3000;

Loading…
Cancel
Save