Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nostraddress / NIP-05 failing #33

Open
tnperron opened this issue Dec 6, 2024 · 4 comments
Open

nostraddress / NIP-05 failing #33

tnperron opened this issue Dec 6, 2024 · 4 comments
Assignees
Labels
awaiting confirmation bug Something isn't working

Comments

@tnperron
Copy link

tnperron commented Dec 6, 2024

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 and req.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.
@quentintaranpino quentintaranpino self-assigned this Dec 9, 2024
@quentintaranpino quentintaranpino added the bug Something isn't working label Dec 9, 2024
@quentintaranpino
Copy link
Owner

Hello!

Thank you for reporting this issue. Could you let me know what req.hostname returns in the debugger?

@tnperron
Copy link
Author

Here's the log entry I kept. Domain and OS username have been sanitized, everything else is original:
{"0":"Raw Host header: \\MYDOMAIN","_meta":{"runtime":"Nodejs","runtimeVersion":"v21.7.3","hostname":"nostrcheck","date":"2024-12-05 17:54:08","logLevelId":2,"logLevelName":"DEBUG","path":{"fullFilePath":"/home/OSUSER/nostrcheck-server/src/controllers/nostraddress.ts:14:12","fileName":"nostraddress.ts","fileNameWithLine":"nostraddress.ts:14","fileColumn":"12","fileLine":"14","filePath":"/src/controllers/nostraddress.ts","filePathWithLine":"/src/controllers/nostraddress.ts:14","method":"getNostraddress"}}}

@quentintaranpino
Copy link
Owner

It might be related to the Nginx configuration. Could you check and let me know what value $host has in your Nginx setup? That could help narrow it down.

@tnperron
Copy link
Author

tnperron commented Jan 4, 2025

"nostrcheck.taylorperron.com" without the quotes. No backslashes present. I double checked by logging from nginx.conf and it reported the same.

I don't mind providing my Nginx configs via DM somewhere if it would help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting confirmation bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants