Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add etag config to proxy #301

Merged
merged 3 commits into from
Jul 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 19 additions & 47 deletions config/nginx/onlyoffice.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ map $request_uri $header_x_frame_options {
default "SAMEORIGIN";
}

map $request_uri $cache_control {
default "public, max-age=10, s-maxage=24h";
~*^/(api\/2\.0*|storage|login\.ashx|products\/*\/httphandlers\/filehandler.ashx|ChunkedUploader.ashx|apisystem|sh) "no-cache, no-store, must-revalidate";
}

include /etc/nginx/includes/onlyoffice-*.conf;

server {
listen 8092;

add_header Access-Control-Allow-Origin *;
add_header X-Frame-Options $header_x_frame_options;
add_header Cache-Control $cache_control;
etag on;

large_client_header_buffers 4 16k;

Expand Down Expand Up @@ -74,46 +81,39 @@ server {
}

location / {

proxy_pass http://localhost:5001;
expires 365d;
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
expires 365d;
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
root $public_root;
try_files /$basename /index.html =404;
}

location ~* /static/images/ {
expires 365d;
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/ {
expires 365d;
root $public_root;
try_files /thirdparty/third-party.html /index.html =404;
}

location ~* /static/locales/(?<content>[^/]+) {
expires 365d;
root $public_root;
try_files /locales/$content/$basename /index.html =404;
}
}

location /login {
#rewrite login/(.*) /$1 break;
expires 365d;
proxy_pass http://localhost:5011;
}

location /sockjs-node {
expires 365d;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
Expand All @@ -128,26 +128,22 @@ server {
}

location /api/2.0 {
expires -1;
add_header Cache-Control $cache_control;
location ~* /(files|encryption|privacyroom) {
expires -1;
proxy_pass http://localhost:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}

location ~* /(people|group) {
expires -1;
proxy_pass http://localhost:5004;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}

location ~* /(authentication|modules|portal|security|settings|smtpsettings|capabilities|thirdparty) {
expires -1;
proxy_pass http://localhost:5000;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;

location ~* portal/(.*)(backup|restore)(.*) {
expires -1;
rewrite (.*)/portal/(.*) $1/backup/$2 break;
proxy_redirect off;

Expand All @@ -158,44 +154,39 @@ server {
}

location ~* /backup {
expires -1;
proxy_pass http://localhost:5012;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}

location ~* /project {
expires -1;
proxy_pass http://localhost:5020;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}

location ~* /crm {
expires -1;
proxy_pass http://localhost:5021;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}

location ~* /mail {
expires -1;
proxy_pass http://localhost:5022;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}

location ~* /calendar {
expires -1;
proxy_pass http://localhost:5023;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
}

location /storage {
expires -1;
add_header Cache-Control $cache_control;
proxy_pass http://localhost:5003;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}

location /login.ashx {
expires -1;
add_header Cache-Control $cache_control;
proxy_pass http://localhost:5003;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
Expand All @@ -204,12 +195,10 @@ server {
location /products {
location ~* /people {
#rewrite products/people/(.*) /$1 break;
expires 365d;
proxy_pass http://localhost:5002;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;

location ~* /(sockjs-node) {
expires 365d;
rewrite products/people(.*)/(sockjs-node)/(.*) /$2/$3 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
Expand All @@ -226,15 +215,13 @@ server {


location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
expires 365d;
root $public_root;
try_files /$basename /index.html =404;
}
}

location ~* /files/doceditor {
#rewrite products/files/doceditor/(.*) /$1 break;
expires 365d;
proxy_pass http://localhost:5013;
proxy_redirect off;
proxy_set_header Host $host;
Expand All @@ -248,12 +235,10 @@ server {

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;
Expand All @@ -268,26 +253,23 @@ server {
}

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) {
expires -1;
add_header Cache-Control $cache_control;
proxy_pass http://localhost:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
}

location ~* /crm {
#rewrite products/crm/(.*) /$1 break;
expires 365d;
proxy_pass http://localhost:5014;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;

location ~* /sockjs-node {
expires 365d;
rewrite products/crm(.*)/sockjs-node/(.*) /$2/$3 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
Expand All @@ -303,26 +285,23 @@ server {
}

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) {
expires -1;
add_header Cache-Control $cache_control;
proxy_pass http://localhost:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
}

location ~* /projects {
#rewrite products/projects/(.*) /$1 break;
expires 365d;
proxy_pass http://localhost:5015;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;

location ~* /sockjs-node {
expires 365d;
rewrite products/projects(.*)/sockjs-node/(.*) /$2/$3 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
Expand All @@ -338,26 +317,23 @@ server {
}

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) {
expires -1;
add_header Cache-Control $cache_control;
proxy_pass http://localhost:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
}

location ~* /mail {
#rewrite products/mail/(.*) /$1 break;
expires 365d;
proxy_pass http://localhost:5016;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;

location ~* /sockjs-node {
expires 365d;
rewrite products/projects(.*)/sockjs-node/(.*) /$2/$3 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
Expand All @@ -373,26 +349,23 @@ server {
}

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) {
expires -1;
add_header Cache-Control $cache_control;
proxy_pass http://localhost:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
}

location ~* /calendar {
#rewrite products/calendar/(.*) /$1 break;
expires 365d;
proxy_pass http://localhost:5017;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;

location ~* /sockjs-node {
expires 365d;
rewrite products/projects(.*)/sockjs-node/(.*) /$2/$3 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
Expand All @@ -408,28 +381,27 @@ server {
}

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) {
expires -1;
add_header Cache-Control $cache_control;
proxy_pass http://localhost:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
}
}

location /apisystem {
expires -1;
add_header Cache-Control $cache_control;
rewrite apisystem/(.*) /$1 break;
proxy_pass http://localhost:5010;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}

location /sh {
expires -1;
add_header Cache-Control $cache_control;
rewrite sh/(.*) /$1 break;
proxy_pass http://localhost:9999;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
Expand Down