Skip to content

Commit

Permalink
Merge pull request #42 from deskpro/mg/deskpro-messenger-caching
Browse files Browse the repository at this point in the history
Deskpro Messenger caching
  • Loading branch information
MattGrundy authored Jul 1, 2024
2 parents 31d040a + cbde44a commit 7797a77
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 34 deletions.
24 changes: 24 additions & 0 deletions etc/nginx/conf.d/deskpro_messenger_server_params
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,27 @@ location ^~ /sys/services/messenger-api/ {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

location ~ ^/deskpro-messenger/assets/ {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Methods' 'GET,OPTIONS';
add_header 'Access-Control-Max-Age' '1728000';
add_header 'Cache-Control' 'public, max-age=31536000, immutable';

if ($request_method = 'OPTIONS') {
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
}

location ^~ /firebase-messaging-sw.js {
fastcgi_pass unix:/run/php_fpm_dp_default.sock;
include /etc/nginx/conf.d/deskpro_fastcgi_params;
}

location ~ ^/deskpro-messenger/ {
fastcgi_pass unix:/run/php_fpm_dp_default.sock;
include /etc/nginx/conf.d/deskpro_fastcgi_params;
}
34 changes: 0 additions & 34 deletions etc/nginx/conf.d/deskpro_server_params
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ location ^~ /static/ {
}
}

location ^~ /firebase-messaging-sw.js {
fastcgi_pass unix:/run/php_fpm_dp_default.sock;
include /etc/nginx/conf.d/deskpro_fastcgi_params;
}

location ~ ^/horizon\-ui/app/assets/ {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' '*';
Expand All @@ -94,32 +89,3 @@ location ~ ^/horizon\-ui/app/assets/ {
return 204;
}
}

location ~ ^/deskpro-messenger/app/assets/ {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Methods' 'GET,OPTIONS';
add_header 'Access-Control-Max-Age' '1728000';
add_header 'Cache-Control' 'public, max-age=31536000, immutable';

if ($request_method = 'OPTIONS') {
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
}

location ~ ^/deskpro-messenger/ {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Methods' 'GET,OPTIONS';
add_header 'Access-Control-Max-Age' '1728000';
add_header 'Cache-Control' 'public, max-age=31536000, immutable';

if ($request_method = 'OPTIONS') {
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
try_files $uri $uri/ /deskpro-messenger/index.html;
}

0 comments on commit 7797a77

Please sign in to comment.