mirror of
https://git.meshkee.com/Meshkee/dashboards.git
synced 2026-08-11 22:30:58 +04:30
Fix dashboard nginx Open Graph bot routing for invoice URLs.
Quote regex braces and proxy via rewrite so api.meshkee.com resolves without a runtime DNS resolver. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
c3408a498a
commit
9e5a03548f
@@ -2,11 +2,12 @@
|
|||||||
#
|
#
|
||||||
# Link-preview bots (WhatsApp, etc.) hitting /invoices/:id get Open Graph HTML
|
# Link-preview bots (WhatsApp, etc.) hitting /invoices/:id get Open Graph HTML
|
||||||
# from the API; browsers still receive the SPA.
|
# from the API; browsers still receive the SPA.
|
||||||
|
#
|
||||||
map $http_user_agent $meshkee_link_preview_bot {
|
# Install the UA map in http context (e.g. /etc/nginx/conf.d/meshkee-link-preview-bots.conf):
|
||||||
default 0;
|
# map $http_user_agent $meshkee_link_preview_bot {
|
||||||
~*(whatsapp|facebookexternalhit|facebot|twitterbot|linkedinbot|slackbot|telegrambot|discordbot) 1;
|
# default 0;
|
||||||
}
|
# ~*(whatsapp|facebookexternalhit|facebot|twitterbot|linkedinbot|slackbot|telegrambot|discordbot) 1;
|
||||||
|
# }
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
@@ -15,7 +16,8 @@ server {
|
|||||||
ssl_certificate_key /etc/letsencrypt/live/meshkee-dashboards/privkey.pem;
|
ssl_certificate_key /etc/letsencrypt/live/meshkee-dashboards/privkey.pem;
|
||||||
ssl_protocols TLSv1.2 TLSv1.3;
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
|
||||||
location ~ ^/invoices/(?<invoice_public_id>[0-9]{6,32})$ {
|
# Quotes required: unquoted {N,M} breaks nginx config parsing.
|
||||||
|
location ~ "^/invoices/(?<invoice_public_id>[0-9]{6,32})$" {
|
||||||
if ($meshkee_link_preview_bot = 1) {
|
if ($meshkee_link_preview_bot = 1) {
|
||||||
rewrite ^ /__internal/invoice-og/$invoice_public_id last;
|
rewrite ^ /__internal/invoice-og/$invoice_public_id last;
|
||||||
}
|
}
|
||||||
@@ -23,9 +25,11 @@ server {
|
|||||||
try_files /index.html =404;
|
try_files /index.html =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/__internal/invoice-og/([0-9]{6,32})$ {
|
location ~ "^/__internal/invoice-og/([0-9]{6,32})$" {
|
||||||
internal;
|
internal;
|
||||||
proxy_pass https://api.meshkee.com/api/v1/public/invoices/$1/og;
|
# rewrite+break keeps proxy_pass host static (no runtime resolver needed)
|
||||||
|
rewrite ^/__internal/invoice-og/(.*)$ /api/v1/public/invoices/$1/og break;
|
||||||
|
proxy_pass https://api.meshkee.com;
|
||||||
proxy_ssl_server_name on;
|
proxy_ssl_server_name on;
|
||||||
proxy_set_header Host api.meshkee.com;
|
proxy_set_header Host api.meshkee.com;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|||||||
Reference in New Issue
Block a user