Open
Description
Describe the bug
nostraddress / NIP-05 GET request failing with USERNAME is not found on \\MYDOMAIN.
Noted the presence of double backslashes before the domain.
To Reproduce
Steps to reproduce the behavior:
Send GET request to https://MYDOMAIN/api/v2/nostraddress?name=USERNAME
via browser.
Expected behavior
A return of NIP-05 standard response of names: USERNAME: HEXNPUB
upon success, or USERNAME is not found on MYDOMAIN
upon failure (note no double backslashes before the domain).
Additional context
- nostrcheck-server 0.6.0 set up via install.sh script on Ubuntu Server 24.04.1 LTS
- Nginx debug logs reported a correct
$host
- Hard-coding domain in place of
req.hostname
on line 22 of nostraddress.ts results in successful NIP-05 GET response. - Adding
logger.debug('Raw req.headers.host: ${req.headers.host}');
after line 22 in nostraddress.ts logs header showing double backslashes before the domain. Seems to suggest double backslashes are being added somewhere between Nginx andreq.hostname
? - Replacing line 22 in nostraddress.ts with
const servername = (req.headers.host || "").replace(/^[\\]+/, "").trim();
cleans the double backslashes. Am currently using this as a workaround.