emotki i profile
Deploy Polska Lokalnie / deploy (push) Successful in 15s

This commit is contained in:
2026-09-08 16:59:53 +02:00
parent 6b334cc1b5
commit a3e4505194
16 changed files with 1445 additions and 24 deletions
+21
View File
@@ -1,3 +1,12 @@
# Crawlery social media (Facebook, WhatsApp, Messenger, Twitter/X, LinkedIn...) nie wykonuja
# JavaScriptu, wiec meta tagi ustawiane w aplikacji React sa dla nich niewidoczne. Po User-Agent
# rozpoznajemy bota i dla adresu /oferta/{id} kierujemy go na serwerowy podglad z tagami Open Graph
# (backend), zamiast na aplikacje SPA. Zwykly uzytkownik dostaje niezmieniona aplikacje.
map $http_user_agent $pl_is_crawler {
default 0;
"~*facebookexternalhit|Facebot|Twitterbot|WhatsApp|Slackbot|LinkedInBot|TelegramBot|Discordbot|Pinterest|redditbot|Applebot|SkypeUriPreview|vkShare|Google-InspectionTool|Googlebot|bingbot|Embedly|Iframely|OpenGraph" 1;
}
server {
listen 80;
server_name _;
@@ -5,6 +14,10 @@ server {
root /usr/share/nginx/html;
index index.html;
# Wbudowany DNS Dockera - potrzebny, bo proxy_pass ze zmienna ($listing_id) rozwiazuje host
# "backend" dopiero przy zadaniu, a nie przy starcie nginx.
resolver 127.0.0.11 ipv6=off valid=30s;
location /api/ {
proxy_pass http://backend:8080/api/;
proxy_http_version 1.1;
@@ -14,6 +27,14 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
# Szczegoly ogloszenia: crawler dostaje serwerowy podglad Open Graph, czlowiek - aplikacje SPA.
location ~ ^/oferta/(?<listing_id>\d+) {
if ($pl_is_crawler) {
proxy_pass http://backend:8080/api/og/listing/$listing_id;
}
try_files $uri /index.html;
}
# Pliki z hashem w nazwie (assets/index-XXXX.js) sa niezmienne - mozna je trzymac dlugo.
location /assets/ {
try_files $uri =404;