This document provides guidance for resolving network connectivity and firewall issues when running the React application.
This application fetches data from external APIs that may be blocked by corporate firewalls, network security policies, or restricted environments:
- CoinGecko API (
https://api.coingecko.com) - Provides real-time Litecoin price data - Mempool.space API (
https://mempool.space) - Provides Litecoin mempool transaction data
- "Failed to fetch" errors in browser console
- Components showing fallback/cached data with warning messages
- Yellow warning banners indicating "API unreachable - may be blocked by firewall"
- Corporate Firewall Rules - Your organization may block access to cryptocurrency-related domains
- Network Security Policies - Security software may prevent connections to certain APIs
- CORS Restrictions - Browser security policies preventing cross-origin requests
- Geographic Restrictions - Some APIs may be unavailable in certain regions
- Rate Limiting - Too many requests to the API
If you have access to alternative API endpoints or proxy servers, you can configure them using environment variables:
-
Copy
.env.exampleto.env.local:cp .env.example .env.local
-
Edit
.env.localand uncomment/modify the API URLs:VITE_COINGECKO_API_URL=https://your-proxy.com/coingecko VITE_MEMPOOL_API_URL=https://your-proxy.com/mempool -
Restart the development server:
npm start
If CORS is the issue, you can use a CORS proxy server:
Using Public CORS Proxy (Development Only):
VITE_COINGECKO_API_URL=https://cors-anywhere.herokuapp.com/https://api.coingecko.com/api/v3/simple/price?ids=litecoin&vs_currencies=usd
Setting Up Your Own CORS Proxy:
For production use, set up your own proxy server:
- Simple Node.js proxy example:
const express = require('express');
const cors = require('cors');
const fetch = require('node-fetch');
const app = express();
app.use(cors());
app.get('/api/coingecko', async (req, res) => {
const response = await fetch('https://api.coingecko.com/api/v3/simple/price?ids=litecoin&vs_currencies=usd');
const data = await response.json();
res.json(data);
});
app.get('/api/mempool', async (req, res) => {
const response = await fetch('https://mempool.space/api/litecoin/txs/mempool');
const data = await response.json();
res.json(data);
});
app.listen(3001, () => console.log('Proxy running on port 3001'));- Configure your
.env.local:
VITE_COINGECKO_API_URL=http://localhost:3001/api/coingecko
VITE_MEMPOOL_API_URL=http://localhost:3001/api/mempool
If you're in a corporate environment:
-
Request that your IT department whitelist the following domains:
api.coingecko.commempool.space
-
Provide them with this documentation explaining why these domains are needed
-
If whitelisting is not possible, work with them to set up an approved proxy server
The application now includes fallback data that automatically activates when APIs are unreachable:
- LitecoinPriceBot: Shows a cached/approximate price when CoinGecko is blocked
- LitecoinMempoolTransactions: Shows sample transaction data when Mempool.space is blocked
Components display a yellow warning banner when using fallback data, so you'll always know when you're not seeing live data.
You can test if the APIs are accessible from your network using curl:
# Test CoinGecko API
curl https://api.coingecko.com/api/v3/simple/price?ids=litecoin&vs_currencies=usd
# Test Mempool.space API
curl https://mempool.space/api/litecoin/txs/mempoolIf these commands fail or timeout, the APIs are likely blocked by your firewall.
- Open your browser's Developer Tools (F12)
- Go to the Network tab
- Reload the application
- Look for failed requests to
api.coingecko.comormempool.space - Check the error messages (e.g., "net::ERR_BLOCKED_BY_CLIENT", "CORS error", "Failed to fetch")
When working around firewall restrictions:
- Never expose API keys or sensitive credentials in environment variables that are committed to git
- Always use
.env.localfor local overrides (it's already in.gitignore) - Prefer backend proxy solutions over public CORS proxies for production
- Consider the security implications of bypassing your organization's firewall policies
- Comply with your organization's security policies and obtain necessary approvals
If you're using GitHub Codespaces and experiencing connectivity issues:
- Codespaces generally has good outbound connectivity, but some regions may have restrictions
- Port forwarding should work automatically for the development server (port 3000)
- If you need to set up a proxy, it will run inside your codespace and should be accessible
If you continue to experience issues:
- Check the browser console for specific error messages
- Review your network security policies
- Contact your IT/network administration team
- Open an issue in the repository with details about your environment and error messages