Require http:// or https:// at front of proxy URL
See original GitHub issueDescription
I’m having trouble with getting the proxy feature to work. I’m not sure if it’s because my API requires HTTP basic authentication. This is my code:
// package.json
{
// ...
"proxy": "http://localhost:4000"
}
fetch('/users', {
headers: {
'accept': 'application/json',
'authorization': 'Basic ' + btoa(process.env.REACT_APP_USERNAME + ':' + process.env.REACT_APP_PASSWORD),
'content-type': 'application/vnd.api+json',
},
});
Expected behavior
I expected it to work, the headers are correct because http://localhost:4000/users
works fine. I don’t have CORS issues because I set my API to accept any origin in development, but I still want to achieve this via the proxy feature.
Actual behavior
I get this error:
Proxy error: Could not proxy request /meetings from localhost:3000 to http://localhost:9292.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED).
Environment
npm ls react-scripts
: react-scripts@0.6.1node -v
: v6.3.0npm -v
: 3.10.3- Operating system: macOS Sierra (10.12)
- Browser and version: Chrome 53.0.2785.116
Reproducible Demo
Issue Analytics
- State:
- Created 7 years ago
- Reactions:6
- Comments:40 (10 by maintainers)
Top Results From Across the Web
http to https node proxy - Stack Overflow
I needed a HTTP->HTTPS node proxy for unit testing. ... server receives the CONNECT request, it sets up a tunnel to the HTTPS...
Read more >Proxy HTTPS requests to a HTTP backend with NGINX
The scenario I want to achieve is: Client makes HTTP request to nginx which is redirect to the same URL but over HTTPS;...
Read more >Proxy servers and tunneling - HTTP - MDN Web Docs
Identifies the originating IP addresses of a client connecting to a web server through an HTTP proxy or a load balancer.
Read more >HTTPS behind your reverse proxy - Reinout van Rees
HTTP/HTTPS connections from browsers (“the green cloud”) go to two reverse proxy servers on the outer border of our network.
Read more >HTTPS-Proxy: Domain Name Rules - WatchGuard Technologies
Domain Name Rule Actions · Allow — Allows the HTTPS request. · Inspect — Uses the specified HTTP proxy action or content action...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@silvenon I am having the same exact issue you are having, so you are not alone. Will report back if I come to a solution.
Hi, I just wanted to post a solution that worked for me. Maybe it will save someone few hours. I am developing PHP backend (Silex). After starting server and CRA app I always got
ECONNREFUSED
when using built-in proxy.Command I used to start my server before:
php -S localhost:8899 -t web
After some research I found out that this could be solved with changing
localhost
to0.0.0.0
:php -S 0.0.0.0:8899 -t web