Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #800
Closed
Open
Issue created Sep 29, 2016 by Administrator@rootContributor

Require http:// or https:// at front of proxy URL

Created by: silvenon

Description

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

  1. npm ls react-scripts: react-scripts@0.6.1
  2. node -v: v6.3.0
  3. npm -v: 3.10.3
  4. Operating system: macOS Sierra (10.12)
  5. Browser and version: Chrome 53.0.2785.116

Reproducible Demo

silvenon/demo-cra-basic-auth

Assignee
Assign to
Time tracking