Skip to content

Commit

Permalink
fix loading web apps on subdomain, closes #22
Browse files Browse the repository at this point in the history
  • Loading branch information
redsolver committed May 16, 2024
1 parent 1391a8a commit abae80f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/http_api/http_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,7 @@ class HttpAPIServer {
final String? domain = node.config['http']?['api']?['domain'];

if (domain != null) {
if (uri.host == 'localhost') {
} else if (uri.host == domain) {
if (uri.host == domain) {
if (request.uri.path == '/s5/p2p') {
final socket = await WebSocketTransformer.upgrade(request);

Expand All @@ -916,6 +915,8 @@ class HttpAPIServer {
} else if (uri.host == 'docs.$domain') {
cid = CID.decode('zrjD7xwmgP8U6hquPUtSRcZP1J1LvksSwTq4CPZ2ck96FHu');
checkAuth = false;
} else if ('.${uri.host}'.endsWith('.$domain')) {
cid = CID.decode(uri.host.split('.').first);
} else if (!('.${uri.host}').endsWith('.$domain')) {
final cidStr = await node.resolveName(uri.host);
cid = CID.decode(cidStr);
Expand Down

0 comments on commit abae80f

Please sign in to comment.