ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.44k stars 1.25k forks source link

HTTPError: not allowed - invalid user agent #4186

Closed PhillyWebGuy closed 2 years ago

PhillyWebGuy commented 2 years ago

I have the origin below explicitly allowed as well as the user agent. And I still get a 403 ("HTTPError: not allowed - invalid user agent").

My creation string:

const client = create({
  host: 'ipfs.infura.io',
  port: 5001,
  protocol: 'https',
  apiPath: '/api/v0',
  headers: {
    Authorization:
      'Basic base64encodedstring',
    Origin: 'http://127.0.0.1:3000',
    'User-Agent':
      'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19'
  }
});
welcome[bot] commented 2 years ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.

PhillyWebGuy commented 2 years ago

A little more info...

I can see via Chrome Dev Tools that the 'User-Agent' header is being ignored and not sent. I could see what my User-Agent was and set to explicitly allow. Now I get a 500 error back with this response:

{"Message":"multipart: NextPart: EOF","Code":0,"Type":"error"}

FWIW, it says type: 'cors' in the error object.

Screen Shot 2022-08-15 at 9 24 57 AM
warrior1112 commented 2 years ago

same issue here also. 403 ("HTTPError: not allowed - invalid user agent"). image

achingbrain commented 2 years ago

You are making requests to ipfs.infura.io - I would suggest you check their documentation or contact them directly to find out what is required as this is unlikely to be a problem with the http client itself.