Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to redirect HTTP requests to HTTPS #1751

Closed
1 of 2 tasks
jakeleventhal opened this issue Mar 31, 2019 · 6 comments
Closed
1 of 2 tasks

Unable to redirect HTTP requests to HTTPS #1751

jakeleventhal opened this issue Mar 31, 2019 · 6 comments

Comments

@jakeleventhal
Copy link

jakeleventhal commented Mar 31, 2019

  • Operating System: Linux
  • Node Version: 11.7.0
  • NPM Version: 6.8.0
  • webpack Version: 4.29.6
  • webpack-dev-server Version: 3.2.1
  • This is a bug
  • This is a modification request

Code

// webpack.config.js
devServer: {
    compress: true,
    contentBase: path.join(__dirname, 'dist'),
    disableHostCheck: true,
    host: '0.0.0.0',
    hot: true,
    https: Boolean(env && env.SERVER === 'production') && {
      ca: fs.readFileSync('/etc/letsencrypt/live/mydomain.com/fullchain.pem'),
      cert: fs.readFileSync('/etc/letsencrypt/live/mydomain.com/cert.pem'),
      key: fs.readFileSync('/etc/letsencrypt/live/mydomain.com/privkey.pem')
    },
    port: 3000
  }

Expected Behavior

When accessing my site via https://mydomain.com, it should work (and it does).
When accessing my site via mydomain.com (HTTP), it should route to the HTTPS version.

Actual Behavior

There is no rerouting

@alexander-akait
Copy link
Member

Not sure it is good for DX purpose, why you need this?

@alexander-akait
Copy link
Member

Also it is development server, so it is good DX to allow developers use http and https together, so i am closing this issue, maybe be we will revisit it in future, feel free to feedback, thanks

@zachzeyuwang
Copy link

@jakeleventhal Any chance you got this working? I have a Vue app configured this way and it only works with "https://" specified. It would be nice if http can be redirected to https.

@jakeleventhal
Copy link
Author

@zachzeyuwang
I wasn't able to do this. Instead I used nginx to reroute requests

@ethanzhl
Copy link

Whether this feature is currently supported?

@alexander-akait
Copy link
Member

I want to say it is duplicarion #126, but with redirect from HTTP server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants