Add cache control in the backend proxy (#299)

* Modify cache control in the proxy

* Cosmetic modify

* Cosmetic modify

* Cosmetic modify

* Cosmetic modify

* Add expires conf

* Del swp file
This commit is contained in:
Sergey Kirichenko 2021-07-09 16:16:15 +03:00 committed by GitHub
parent 1f76d64048
commit 9546e04e44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,39 +75,45 @@ server {
location / { location / {
proxy_pass http://localhost:5001; proxy_pass http://localhost:5001;
expires 365d;
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) { location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
expires 365d;
root $public_root; root $public_root;
try_files /$basename /index.html =404; try_files /$basename /index.html =404;
} }
location ~* /static/images/ { location ~* /static/images/ {
root $public_root; expires 365d;
try_files /images/$basename /index.html =404; root $public_root;
try_files /images/$basename /index.html =404;
}
location ~* /static/offline/ {
expires 365d;
root $public_root;
try_files /offline/$basename /index.html =404;
} }
location ~* /thirdparty/ {
location ~* /static/offline/ { expires 365d;
root $public_root; root $public_root;
try_files /offline/$basename /index.html =404; try_files /thirdparty/third-party.html /index.html =404;
} }
location ~* /thirdparty/ { location ~* /static/locales/(?<content>[^/]+) {
root $public_root; expires 365d;
try_files /thirdparty/third-party.html /index.html =404; root $public_root;
} try_files /locales/$content/$basename /index.html =404;
location ~* /static/locales/(?<content>[^/]+) {
root $public_root;
try_files /locales/$content/$basename /index.html =404;
} }
} }
location /login { location /login {
#rewrite login/(.*) /$1 break; #rewrite login/(.*) /$1 break;
proxy_pass http://localhost:5011; expires 365d;
proxy_pass http://localhost:5011;
} }
location /sockjs-node { location /sockjs-node {
expires 365d;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host; proxy_set_header Host $host;
@ -122,21 +128,26 @@ server {
} }
location /api/2.0 { location /api/2.0 {
expires -1;
location ~* /(files|encryption|privacyroom) { location ~* /(files|encryption|privacyroom) {
expires -1;
proxy_pass http://localhost:5007; proxy_pass http://localhost:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
location ~* /(people|group) { location ~* /(people|group) {
expires -1;
proxy_pass http://localhost:5004; proxy_pass http://localhost:5004;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
location ~* /(authentication|modules|portal|security|settings|smtpsettings|capabilities|thirdparty) { location ~* /(authentication|modules|portal|security|settings|smtpsettings|capabilities|thirdparty) {
expires -1;
proxy_pass http://localhost:5000; proxy_pass http://localhost:5000;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
location ~* portal/(.*)(backup|restore)(.*) { location ~* portal/(.*)(backup|restore)(.*) {
expires -1;
rewrite (.*)/portal/(.*) $1/backup/$2 break; rewrite (.*)/portal/(.*) $1/backup/$2 break;
proxy_redirect off; proxy_redirect off;
@ -147,37 +158,44 @@ server {
} }
location ~* /backup { location ~* /backup {
expires -1;
proxy_pass http://localhost:5012; proxy_pass http://localhost:5012;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
location ~* /project { location ~* /project {
expires -1;
proxy_pass http://localhost:5020; proxy_pass http://localhost:5020;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
location ~* /crm { location ~* /crm {
expires -1;
proxy_pass http://localhost:5021; proxy_pass http://localhost:5021;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
location ~* /mail { location ~* /mail {
proxy_pass http://localhost:5022; expires -1;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_pass http://localhost:5022;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
location ~* /calendar { location ~* /calendar {
proxy_pass http://localhost:5023; expires -1;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_pass http://localhost:5023;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
} }
location /storage { location /storage {
expires -1;
proxy_pass http://localhost:5003; proxy_pass http://localhost:5003;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
location /login.ashx { location /login.ashx {
expires -1;
proxy_pass http://localhost:5003; proxy_pass http://localhost:5003;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
@ -186,10 +204,12 @@ server {
location /products { location /products {
location ~* /people { location ~* /people {
#rewrite products/people/(.*) /$1 break; #rewrite products/people/(.*) /$1 break;
expires 365d;
proxy_pass http://localhost:5002; proxy_pass http://localhost:5002;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
location ~* /(sockjs-node) { location ~* /(sockjs-node) {
expires 365d;
rewrite products/people(.*)/(sockjs-node)/(.*) /$2/$3 break; rewrite products/people(.*)/(sockjs-node)/(.*) /$2/$3 break;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
@ -206,62 +226,68 @@ server {
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) { location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
expires 365d;
root $public_root; root $public_root;
try_files /$basename /index.html =404; try_files /$basename /index.html =404;
} }
} }
location ~* /files/doceditor {
#rewrite products/files/doceditor/(.*) /$1 break;
proxy_pass http://localhost:5013;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ~* /files {
#rewrite products/files/(.*) /$1 break;
proxy_pass http://localhost:5008;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
location ~* /sockjs-node { location ~* /files/doceditor {
rewrite products/files(.*)/sockjs-node/(.*) /$2/$3 break; #rewrite products/files/doceditor/(.*) /$1 break;
proxy_set_header X-Real-IP $remote_addr; expires 365d;
proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://localhost:5013;
proxy_set_header Host $host; proxy_redirect off;
proxy_set_header Host $host;
proxy_pass http://localhost:5008; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) { proxy_http_version 1.1;
root $public_root; proxy_set_header Upgrade $http_upgrade;
try_files /$basename /index.html =404; proxy_set_header Connection "upgrade";
}
location ~* /files {
#rewrite products/files/(.*) /$1 break;
expires 365d;
proxy_pass http://localhost:5008;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
location ~* /sockjs-node {
expires 365d;
rewrite products/files(.*)/sockjs-node/(.*) /$2/$3 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://localhost:5008;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
expires 365d;
root $public_root;
try_files /$basename /index.html =404;
} }
location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) { location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) {
expires -1;
proxy_pass http://localhost:5007; proxy_pass http://localhost:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
} }
location ~* /crm { location ~* /crm {
#rewrite products/crm/(.*) /$1 break; #rewrite products/crm/(.*) /$1 break;
expires 365d;
proxy_pass http://localhost:5014; proxy_pass http://localhost:5014;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
location ~* /sockjs-node { location ~* /sockjs-node {
expires 365d;
rewrite products/crm(.*)/sockjs-node/(.*) /$2/$3 break; rewrite products/crm(.*)/sockjs-node/(.*) /$2/$3 break;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
@ -277,53 +303,61 @@ server {
} }
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) { location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
expires 365d;
root $public_root; root $public_root;
try_files /$basename /index.html =404; try_files /$basename /index.html =404;
} }
location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) { location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) {
expires -1;
proxy_pass http://localhost:5007; proxy_pass http://localhost:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
} }
location ~* /projects { location ~* /projects {
#rewrite products/projects/(.*) /$1 break; #rewrite products/projects/(.*) /$1 break;
expires 365d;
proxy_pass http://localhost:5015; proxy_pass http://localhost:5015;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
location ~* /sockjs-node { location ~* /sockjs-node {
rewrite products/projects(.*)/sockjs-node/(.*) /$2/$3 break; expires 365d;
proxy_set_header X-Real-IP $remote_addr; rewrite products/projects(.*)/sockjs-node/(.*) /$2/$3 break;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://localhost:5015; proxy_pass http://localhost:5015;
proxy_redirect off; proxy_redirect off;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
} }
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) { location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
expires 365d;
root $public_root; root $public_root;
try_files /$basename /index.html =404; try_files /$basename /index.html =404;
} }
location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) { location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) {
expires -1;
proxy_pass http://localhost:5007; proxy_pass http://localhost:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
} }
location ~* /mail { location ~* /mail {
#rewrite products/mail/(.*) /$1 break; #rewrite products/mail/(.*) /$1 break;
expires 365d;
proxy_pass http://localhost:5016; proxy_pass http://localhost:5016;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
location ~* /sockjs-node { location ~* /sockjs-node {
expires 365d;
rewrite products/projects(.*)/sockjs-node/(.*) /$2/$3 break; rewrite products/projects(.*)/sockjs-node/(.*) /$2/$3 break;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
@ -339,22 +373,26 @@ server {
} }
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) { location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
expires 365d;
root $public_root; root $public_root;
try_files /$basename /index.html =404; try_files /$basename /index.html =404;
} }
location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) { location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) {
expires -1;
proxy_pass http://localhost:5007; proxy_pass http://localhost:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
} }
location ~* /calendar { location ~* /calendar {
#rewrite products/calendar/(.*) /$1 break; #rewrite products/calendar/(.*) /$1 break;
expires 365d;
proxy_pass http://localhost:5017; proxy_pass http://localhost:5017;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
location ~* /sockjs-node { location ~* /sockjs-node {
expires 365d;
rewrite products/projects(.*)/sockjs-node/(.*) /$2/$3 break; rewrite products/projects(.*)/sockjs-node/(.*) /$2/$3 break;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
@ -370,11 +408,13 @@ server {
} }
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) { location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
expires 365d;
root $public_root; root $public_root;
try_files /$basename /index.html =404; try_files /$basename /index.html =404;
} }
location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) { location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) {
expires -1;
proxy_pass http://localhost:5007; proxy_pass http://localhost:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
@ -382,14 +422,16 @@ server {
} }
location /apisystem { location /apisystem {
expires -1;
rewrite apisystem/(.*) /$1 break; rewrite apisystem/(.*) /$1 break;
proxy_pass http://localhost:5010; proxy_pass http://localhost:5010;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
location /sh { location /sh {
expires -1;
rewrite sh/(.*) /$1 break; rewrite sh/(.*) /$1 break;
proxy_pass http://localhost:9999; proxy_pass http://localhost:9999;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL; proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
} }
} }