← back to Kamatera Nginx
sites-available/grassclothwallcoverings.com
176 lines
server {
listen 80;
listen [::]:80;
server_name grassclothwallcoverings.com www.grassclothwallcoverings.com;
# CloudFlare real IP
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 131.0.72.0/22;
real_ip_header CF-Connecting-IP;
# Block CopyrightAgent crawlers
if ($http_user_agent ~* "copyrightagent|copyrightbot") {
return 403;
}
# Color API proxy (public read-only for Shopify embed)
location /color-api/ {
proxy_pass http://localhost:9876/api/public/color/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# CORS for Shopify storefront
add_header Access-Control-Allow-Origin "https://www.designerwallcoverings.com" always;
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
add_header Access-Control-Allow-Headers "Content-Type" always;
add_header Access-Control-Max-Age 86400 always;
if ($request_method = OPTIONS) {
return 204;
}
# Rate limit: 30 req/min per IP
limit_req zone=colorapi burst=10 nodelay;
}
# Color swatches proxy (paint chip images)
location /color-swatches/ {
proxy_pass http://localhost:9876/swatches/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
add_header Access-Control-Allow-Origin "https://www.designerwallcoverings.com" always;
add_header Cache-Control "public, max-age=86400" always;
}
# Trade Program API proxy
location /api/trade/ {
proxy_pass http://127.0.0.1:9887/api/trade/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Access-Control-Allow-Origin "*" always;
add_header Access-Control-Allow-Methods "POST, GET, OPTIONS" always;
add_header Access-Control-Allow-Headers "Content-Type" always;
if ($request_method = OPTIONS) { return 204; }
}
# Proxy to local GrassclothWallcoverings app
location / {
proxy_pass http://localhost:9080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header CF-Connecting-IP $http_cf_connecting_ip;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name grassclothwallcoverings.com www.grassclothwallcoverings.com;
ssl_certificate /etc/letsencrypt/live/grassclothwallcoverings.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/grassclothwallcoverings.com/privkey.pem;
# CloudFlare real IP
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 131.0.72.0/22;
real_ip_header CF-Connecting-IP;
# Block CopyrightAgent crawlers
if ($http_user_agent ~* "copyrightagent|copyrightbot") {
return 403;
}
# Color API proxy (public read-only for Shopify embed)
location /color-api/ {
proxy_pass http://localhost:9876/api/public/color/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
add_header Access-Control-Allow-Origin "https://www.designerwallcoverings.com" always;
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
add_header Access-Control-Allow-Headers "Content-Type" always;
add_header Access-Control-Max-Age 86400 always;
if ($request_method = OPTIONS) {
return 204;
}
limit_req zone=colorapi burst=10 nodelay;
}
# Color swatches proxy
location /color-swatches/ {
proxy_pass http://localhost:9876/swatches/;
proxy_http_version 1.1;
proxy_set_header Host $host;
add_header Access-Control-Allow-Origin "https://www.designerwallcoverings.com" always;
add_header Cache-Control "public, max-age=86400" always;
}
# Trade Program API proxy
location /api/trade/ {
proxy_pass http://127.0.0.1:9887/api/trade/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Access-Control-Allow-Origin "*" always;
add_header Access-Control-Allow-Methods "POST, GET, OPTIONS" always;
add_header Access-Control-Allow-Headers "Content-Type" always;
if ($request_method = OPTIONS) { return 204; }
}
# Proxy to local GrassclothWallcoverings app
location / {
proxy_pass http://localhost:9080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header CF-Connecting-IP $http_cf_connecting_ip;
}
}