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
  • !5061

Enable staticOptions.redirect to be passed to serve-static.

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/laran/next into next Sep 21, 2018
  • Overview 3
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: laran

I deploy my app to S3 as a static site. S3 handles routing differently than webpackDevServer does with the default config. Specifically, serve-static is configured to redirect request to files to the folder with the same name when both a file and a folder with the same name exist in the same directory.

Because of this, and the way my app works, my app works fine on S3 but is broken locally because the routing is handled differently.

I found the way to prevent this behavior locally is to set "staticOptions: {redirect: false}" in webpackDevServer.config.js. The way I implemented it retains the existing default behavior, allowing it to be overridden with an environment variable.

This option is a requirement for me in order for my app to work properly both locally and after deployment to S3.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/laran/next