Skip to content
Merged
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
2 changes: 1 addition & 1 deletion deploy/nginx/host/dev/dev.procollab.ru
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ server {
include /etc/nginx/procollab/includes/proxy_app.inc;
}

location ~ ^/(admin|api-auth|files|industries|news|projects|vacancies|core|invites|auth|chats|events|programs|courses|rate-project|evaluation|feed|api|anymail|ws)(/|$) {
location ~ ^/(admin|api-auth|files|industries|news|projects|vacancies|core|invites|solution-invitations|solution-form-templates|auth|chats|events|programs|courses|rate-project|evaluation|feed|api|anymail|ws)(/|$) {
include /etc/nginx/procollab/includes/proxy_app.inc;
}

Expand Down
2 changes: 2 additions & 0 deletions scripts/check_dev_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def check_routes(base_url, context=None):
# These invalid requests cannot send reset email or change a password.
for path, method, expected in (
("/auth/users/current/", "GET", 401),
("/solution-invitations/?status=pending&limit=100&offset=0", "GET", 401),
("/solution-form-templates/", "GET", 401),
("/auth/reset_password/", "POST", 400),
("/auth/reset_password/confirm/", "POST", 400),
("/auth/reset_password/validate_token/", "POST", 400),
Expand Down
12 changes: 10 additions & 2 deletions scripts/tests/test_dev_nginx_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def respond(self, status):
self.wfile.write(body)

def do_GET(self):
self.respond(401 if self.path == "/auth/users/current/" else 404)
protected = {"/auth/users/current/", "/solution-invitations/", "/solution-form-templates/"}
self.respond(401 if self.path.partition("?")[0] in protected else 404)

def do_POST(self):
self.rfile.read(int(self.headers.get("Content-Length", 0)))
Expand Down Expand Up @@ -104,10 +105,17 @@ def test_spa_reads_and_api_requests(self):
time.sleep(0.1)
check_routes(base_url, context)
# Unknown auth URLs and protected APIs never fall through to SPA.
for path in ("/auth/unknown/", "/auth/login/unrecognized/", "/programs/6/"):
for path in (
"/auth/unknown/", "/auth/login/unrecognized/", "/programs/6/",
"/solution-invitations/123/", "/solution-invitations/123/accept/",
"/solution-form-templates/unknown/",
):
status, content_type, body = request(base_url, path, context=context)
self.assertEqual((status, content_type), (404, "application/json"))
self.assertEqual(json.loads(body)["backend_path"], path)
status, content_type, body = request(base_url, "/solution-invitations-about", context=context)
self.assertEqual((status, content_type), (200, "text/html"))
self.assertIn(b"<app-root", body)
status, _, body = request(base_url, "/asset.js", context=context)
self.assertEqual((status, body), (200, b"window.fixture = true;"))
finally:
Expand Down
Loading