Skip to content

Commit

Permalink
Do not use resources subdomain
Browse files Browse the repository at this point in the history
  • Loading branch information
coyotte508 committed Oct 4, 2024
1 parent 4420ac9 commit d9727b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions apps/api/app/config/nginx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ server {
try_files $uri $uri/ @proxy_game_server;
}

location /resources {
try_files $uri $uri/ @resources;
}

location /api {
try_files $uri $uri/ @proxy;
}
Expand All @@ -67,6 +71,20 @@ server {
proxy_redirect off;
}

location @resources {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Forwarded-Proto $scheme;

// Rewrite url to remove "/resources" prefix
rewrite ^/resources/(.*) /$1 break;

proxy_pass http://gaia_resources;
proxy_redirect off;
}

location @proxy_game_server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Game/StartedGame.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
let stateSent = false;
const resourcesLink =
session.host.startsWith("localhost") || session.host.endsWith("gitpod.io")
session.host.startsWith("localhost") || session.host.endsWith("gitpod.io") || session.host === "boardgamers.space"
? `/resources`
: `//resources.${session.host.slice(session.host.indexOf(".") + 1)}`;
Expand Down Expand Up @@ -192,7 +192,7 @@
if ($game.status === "active") {
title = `${gameId} - ${gameLabel($gameInfo.label)} game`;
description = `Round ${$game.data.round}
${$game.players.map((pl) => `- ${pl.name} (${pl.score} pts)`).join("\n")}`;
} else if ($game.cancelled) {
title = `Cancelled - ${gameLabel($gameInfo.label)} game`;
Expand Down

0 comments on commit d9727b6

Please sign in to comment.