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

Local testing with IPFS does not work from browser #2335

Closed
jasonrhaas opened this issue Oct 3, 2018 · 2 comments · Fixed by #2336
Closed

Local testing with IPFS does not work from browser #2335

jasonrhaas opened this issue Oct 3, 2018 · 2 comments · Fixed by #2336
Assignees
Labels
bug This is something that isn't working as intended.

Comments

@jasonrhaas
Copy link
Contributor

Describe the bug
We have a local version of IPFS in a docker container for local testing. If works fine from the web docker container if you set the .env file to these values:

# IPFS setup
IPFS_HOST=ipfs
IPFS_API_PORT=5001
IPFS_API_SCHEME=http

With these settings, the web container can access the ipfs container just fine. However, when trying to access IPFS from the localhost browser, it does not work. There are a couple problems:

  • Javascript will read the Django.settings IPFS_HOST as ipfs. This works from docker, but from your browser this needs to be changed to localhost.
  • IPFS will return a CORS error. The configuration for IPFS needs to be changed to allow the connection from any host (arbitrary docker host IP).

To Reproduce
Try testing anything in the browser that requires IPFS, using the docker IPFS, with those .env settings.

Expected behavior
It should work the same with localhost IPFS as it does with ipfs.gitcoin.co or infura.

Recommend fix

  • Translate ipfs to localhost in javascript
  • Mount an ipfsconfig.json file in the docker-compose file for ipfs.

I have the fix for this in a private repo. I can make the PR for this if you all approve.

Desktop (please complete the following information):

  • OS: Mac Mojave
  • Browser Newest Chrome
@mbeacom mbeacom added the bug This is something that isn't working as intended. label Oct 3, 2018
@mbeacom
Copy link
Contributor

mbeacom commented Oct 3, 2018

Whoops - Submitting a quick fix for this.

@mbeacom
Copy link
Contributor

mbeacom commented Oct 3, 2018

@jasonrhaas Whenever you get a minute, feel free to check out #2336

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is something that isn't working as intended.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants