fedify icon indicating copy to clipboard operation
fedify copied to clipboard

Allow `getNodeInfo` to pass native fetch options (or just custom request headers?)

Open kakkokari-gtyih opened this issue 1 year ago • 3 comments

This is useful when you want to customize the behavior more than normal fetch, such as adding custom headers or setting AbortController.

Specifically, there are use cases such as specifying User-Agent header to avoid firewalls (e.g. Cloudflare).

kakkokari-gtyih avatar Nov 03 '24 09:11 kakkokari-gtyih

First, we created an option to set the User-Agent header. If you don't give any options, all HTTP requests that Fedify makes will have the User-Agent header as shown below (the values in the parentheses vary depending on the JavaScript runtime):

Fedify/1.3.0 (Deno/2.0.4)

In functions like getNodeInfo() or createFederation(), if you pass the userAgent option like this: { software: "MyApp/1.0.0", url: "https://example.com/" }, it will create a User-Agent like the one below:

MyApp/1.0.0 (Fedify/1.3.0; Deno/2.0.4; +https://example.com/)

Alternatively, if you give the userAgent option a string at all, it will use the entire string as the value of the User-Agent header.

We also added the -u/--user-agent option to the fedify lookup and fedify node commands to allow custom User-Agent headers to be used.

These changes will be coming in Fedify 1.3.0.

dahlia avatar Nov 04 '24 10:11 dahlia

@dahlia This issue has been assigned for over two weeks without updates. Please provide a status update, or unassign yourself if you're unable to continue working on it.

github-actions[bot] avatar Oct 09 '25 09:10 github-actions[bot]

@dahlia This issue has been assigned for over two weeks without updates. Please provide a status update, or unassign yourself if you're unable to continue working on it.

github-actions[bot] avatar Oct 24 '25 01:10 github-actions[bot]