diff --git a/backend/middlewares/auth.mjs b/backend/middlewares/auth.mjs index 7192b63..3bcdbf6 100644 --- a/backend/middlewares/auth.mjs +++ b/backend/middlewares/auth.mjs @@ -9,6 +9,5 @@ export const auth = async (req, res, next) => { res.send({ message: 'unauthorized' }); return; } - console.log('middleware', res.locals.user, await res.locals.user.spotify.local); next(); }; diff --git a/nginx.conf b/nginx.conf index 5585524..c36ff97 100644 --- a/nginx.conf +++ b/nginx.conf @@ -20,6 +20,7 @@ http { # tcp_nodelay on; # gzip on; client_max_body_size 1m; + proxy_cache_path ./cache/ keys_zone=public_api_cache:1m; server { listen 8080 default_server; @@ -83,6 +84,18 @@ http { 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 { default_type application/json; proxy_pass http://backend:3000;