Skip to content
Open
Show file tree
Hide file tree
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
58 changes: 58 additions & 0 deletions site/nginx-rustchain-org.conf
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,35 @@ server {
}
}

# Beacon Atlas agent auto-registration (bounty #2127: POST /beacon/join
# must reach the Atlas API on 8071; app route lives in node/beacon_api.py)
location = /beacon/join {
proxy_pass http://127.0.0.1:8071/beacon/join;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 30s;
add_header Access-Control-Allow-Origin "*" always;
add_header Access-Control-Allow-Methods "POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "Content-Type, Authorization" always;
if ($request_method = OPTIONS) {
return 204;
}
}

# Beacon Atlas agent listing (bounty #2127: GET /beacon/atlas)
location = /beacon/atlas {
proxy_pass http://127.0.0.1:8071/beacon/atlas;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 30s;
add_header Access-Control-Allow-Origin "*" always;
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
add_header Access-Control-Allow-Headers "Content-Type, Authorization" always;
if ($request_method = OPTIONS) {
return 204;
}
}

# BEP-2: External Agent Relay endpoints
# Beacon SEO: Agent profiles, directory, sitemap, llms.txt
location /beacon/agent/ {
Expand Down Expand Up @@ -436,6 +465,35 @@ server {
}
}

# Beacon Atlas agent auto-registration (bounty #2127: POST /beacon/join
# must reach the Atlas API on 8071; app route lives in node/beacon_api.py)
location = /beacon/join {
proxy_pass http://127.0.0.1:8071/beacon/join;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 30s;
add_header Access-Control-Allow-Origin "*" always;
add_header Access-Control-Allow-Methods "POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "Content-Type, Authorization" always;
if ($request_method = OPTIONS) {
return 204;
}
}

# Beacon Atlas agent listing (bounty #2127: GET /beacon/atlas)
location = /beacon/atlas {
proxy_pass http://127.0.0.1:8071/beacon/atlas;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 30s;
add_header Access-Control-Allow-Origin "*" always;
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
add_header Access-Control-Allow-Headers "Content-Type, Authorization" always;
if ($request_method = OPTIONS) {
return 204;
}
}

# BEP-2: External Agent Relay endpoints
# Beacon SEO: Agent profiles, directory, sitemap, llms.txt
location /beacon/agent/ {
Expand Down
22 changes: 22 additions & 0 deletions tests/test_rustchain_org_nginx_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,25 @@ def test_rustchain_org_nginx_proxies_ready_and_api_nodes():
assert api_nodes_locations == 2
assert config.count("proxy_pass http://127.0.0.1:8099/ready;") == 2
assert config.count("proxy_pass http://127.0.0.1:8099/api/nodes;") == 2


def test_rustchain_org_nginx_beacon_join_routed_to_atlas_in_all_server_blocks():
"""Bounty #2127: POST /beacon/join must reach the Atlas API on 8071."""
config = (ROOT / "site" / "nginx-rustchain-org.conf").read_text(encoding="utf-8")

join_locations = config.count("location = /beacon/join {")

assert join_locations == 2
assert config.count("proxy_pass http://127.0.0.1:8071/beacon/join;") == join_locations
assert config.count('add_header Access-Control-Allow-Methods "POST, OPTIONS" always;') >= join_locations


def test_rustchain_org_nginx_beacon_atlas_routed_to_atlas_in_all_server_blocks():
"""Bounty #2127: GET /beacon/atlas must reach the Atlas API on 8071."""
config = (ROOT / "site" / "nginx-rustchain-org.conf").read_text(encoding="utf-8")

atlas_locations = config.count("location = /beacon/atlas {")

assert atlas_locations == 2
assert config.count("proxy_pass http://127.0.0.1:8071/beacon/atlas;") == atlas_locations
assert config.count('add_header Access-Control-Allow-Methods "GET, OPTIONS" always;') >= atlas_locations