From 9ab8e284bc63a9959abe7a05073ea2fdf6ee8617 Mon Sep 17 00:00:00 2001 From: Manishoo Date: Wed, 21 Oct 2020 20:25:36 +0330 Subject: [PATCH] Add embed locations to nginx --- containers/nginx/dev-ssr.conf.tpl | 8 +++++++- containers/nginx/minds.conf | 32 ++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/containers/nginx/dev-ssr.conf.tpl b/containers/nginx/dev-ssr.conf.tpl index 1aab42b39f..fbb5107987 100644 --- a/containers/nginx/dev-ssr.conf.tpl +++ b/containers/nginx/dev-ssr.conf.tpl @@ -96,6 +96,12 @@ server { log_not_found off; } + location /embed-static/ { + alias /var/www/Minds/front/dist/embed/; + expires 1y; + log_not_found off; + } + location ~ ^(/api|/fs|/icon|/carousel|/emails/unsubscribe) { add_header 'Access-Control-Allow-Origin' "$http_origin"; add_header 'Access-Control-Allow-Credentials' 'true'; @@ -131,7 +137,7 @@ server { fastcgi_pass php-fpm:9000; fastcgi_index index.php; - fastcgi_buffers 64 32k; + fastcgi_buffers 64 32k; fastcgi_buffer_size 64k; include fastcgi_params; diff --git a/containers/nginx/minds.conf b/containers/nginx/minds.conf index 35cbf54992..2d4a87cd85 100644 --- a/containers/nginx/minds.conf +++ b/containers/nginx/minds.conf @@ -4,7 +4,7 @@ server { index index.html; server_name _; - + error_log /dev/stdout warn; access_log /dev/stdout main; @@ -65,6 +65,12 @@ server { etag off; } + location /embed/ { + add_header 'Access-Control-Allow-Origin' *; + add_header X-Frame-Options ""; + add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive"; + } + location / { if ($is_cdn) { return 301 https://www.minds.com$request_uri; @@ -116,10 +122,10 @@ server { add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With,X-No-Cache,X-Robots-Tag'; - + rewrite ^(.+)$ /index.php last; } - + # Prod mode will proxy an s3 bucket # Dev mode uses the dist/browser location (see dev-srr.conf.tpl) location /static/ { @@ -133,11 +139,27 @@ server { proxy_intercept_errors on; proxy_ssl_verify off; proxy_ssl_server_name on; - #proxy_ssl off; + #proxy_ssl off; proxy_pass https://cdn-assets.minds.com/front/dist/browser/; proxy_redirect off; } + location /embed-static/ { + expires 1y; + log_not_found off; + + add_header 'Access-Control-Allow-Origin' *; + + proxy_http_version 1.1; + proxy_set_header Host cdn-assets.minds.com; + proxy_intercept_errors on; + proxy_ssl_verify off; + proxy_ssl_server_name on; + #proxy_ssl off; + proxy_pass https://cdn-assets.minds.com/front/dist/embed/; + proxy_redirect off; + } + location /robots.txt { rewrite ^(.+)$ /sitemaps/robots.txt last; } @@ -177,7 +199,7 @@ server { fastcgi_pass php-fpm:9000; fastcgi_index index.php; - fastcgi_buffers 64 32k; + fastcgi_buffers 64 32k; fastcgi_buffer_size 64k; fastcgi_max_temp_file_size 0;