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

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

Open
kakkokari-gtyih opened this issue Nov 3, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@kakkokari-gtyih
Copy link

kakkokari-gtyih commented Nov 3, 2024

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 kakkokari-gtyih changed the title Allow getNodeInfo to pass native fetch options Allow getNodeInfo to pass native fetch options (or just custom request headers?) Nov 3, 2024
@dahlia dahlia added the enhancement New feature or request label Nov 3, 2024
@dahlia dahlia self-assigned this Nov 4, 2024
dahlia added a commit that referenced this issue Nov 4, 2024
@dahlia
Copy link
Owner

dahlia commented Nov 4, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants