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
  • Merge requests
  • !1790

Change proxy handling to allow multiple proxies in development

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/jamesblight/multiple-proxies into master Mar 11, 2017
  • Overview 23
  • Commits 12
  • Pipelines 0
  • Changes 4

Created by: jamesblight

This is an attempt to resolve #1780 (closed) by using the proxy handling of Webpack dev server to allow multiple proxies to be added to package.json. Supported config options can be found here: https://webpack.github.io/docs/webpack-dev-server.html#proxy

The changes are compatible with the previous method and behaviour of providing a simple proxy string

{
    "proxy": "http://localhost:4000"
}

I've tested the following proxy scenarios:

Proxy as a string

Expected behaviour is maintained. Requests that accept text/html always fallback to /index.html

Proxy as an object in the form:

{
    "proxy": { "<context>": { "target": "<url>" } }
}

All matching requests are proxied to the target. This includes requests with a 'text/html' Accept Header. It is up to the user to bypass those requests manually in the config.

No proxy specified in package.json

All requests fallback to /index.html

This change relies on Webpack dev server being updated to handle the external websocket upgrade as CRA no longer adds the proxy middleware.

This is a step towards #671 (closed) #1702 (closed) Should be solved by adding a custom oauth callback proxy

EDIT: Webpack dev server v2.4.2 handles the external websocket upgrade for all proxies. webpack/webpack-dev-server#843

Please provide any feedback.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/jamesblight/multiple-proxies