Commit 6be9d8b3 authored by Mark Harding's avatar Mark Harding

(fix): changes to nginx post ssr changes

parent 0d8c757b
......@@ -15,19 +15,41 @@ server {
rewrite ^/(.*)$ https://www.minds.com/$1 permanent;
}
# Register this before HTTP redirect
location /--health-check {
rewrite /health / last;
}
if ($http_x_forwarded_proto != "https") {
rewrite ^(.*)$ https://$host$REQUEST_URI permanent;
rewrite ^/(.*)$ https://$host$REQUEST_URI permanent;
}
sendfile off;
location @nossr {
root /dist/en;
try_files /index.html =404;
}
location / {
error_page 418 = @nossr;
recursive_error_pages on;
set $nossr 0;
if ($http_cookie ~* "nossr") {
set $nossr 1;
}
if ($nossr = 1) {
return 418;
}
port_in_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://front:4200/;
proxy_pass http://front:4200;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
......@@ -36,7 +58,7 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~ ^(/api|/fs|/icon|/carousel) {
location ~ ^(/api|/fs|/icon|/carousel|/checkout|/oauth2|/archive/thumbnail) {
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
add_header 'Access-Control-Allow-Origin' "$http_origin";
add_header 'Access-Control-Allow-Credentials' 'true';
......@@ -46,6 +68,22 @@ server {
rewrite ^(.+)$ /index.php last;
}
location /sitemap.xml {
rewrite ^(.+)$ /sitemaps/sitemap.xml last;
}
location /sitemaps {
proxy_http_version 1.1;
proxy_set_header Host minds-sitemaps.s3.us-east-1.amazonaws.com;
proxy_intercept_errors on;
proxy_pass http://minds-sitemaps.s3.us-east-1.amazonaws.com/minds.com;
}
# Admin endpoint should not use SSR
location ~ ^(/admin) {
try_files $uri $uri/ /index.html;
}
location ~* \.(png|jpg|jpeg|gif|ico|js|css)$ {
expires 1y;
log_not_found off;
......@@ -107,7 +145,7 @@ server {
fastcgi_param HTTP_AUTHORIZATION $http_authorization;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml|svg)$ {
location ~* \.(jpg|jpeg|gif|png|css|js|ico|svg)$ {
expires 5d;
}
......
......@@ -2,7 +2,7 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
error_log /dev/stdout warn;
pid /var/run/nginx.pid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment