Open romrayster opened 4 years ago
For those who stumble on a similar issue, a workaround would be to use this module: https://github.com/mbasso/react-https-redirect which redirects on the client side. Due to a lack of solution I've switched to nginx, would be curious though if the redirect is theoreitcally possible with serve
@romrayster Is it possible to share your nginx config? Im trying to do the exact same thing..
It would be really nice to be able to drop a "redirectToHttps": true
or "forceHttps": true
into serve.json and have this happen automatically.
shameless self-promotion alert:
this feature is available in my @warren-bank/serve
fork of serve
see: the --force-https
option
You could use redirection from http to https with the configuration file serve.json
{
"redirects": [
{
"source": "/(.*)/?",
"destination": "https://yourdomainhere.com/$1",
"type": 301
}
]
}
Use this: { "headers": [ { "source": "/(.*)", "headers": [ { "key": "Strict-Transport-Security", "value": "max-age=63072000; includeSubDomains; preload" } ] } ] }
You could use redirection from http to https with the configuration file
serve.json
{ "redirects": [ { "source": "/(.*)/?", "destination": "https://yourdomainhere.com/$1", "type": 301 } ] }
This one worked fine for me
Hello, I would like to redirect all http traffic to https and I am using an instance of create-react-app Currently, I have two instances of serve running:
(sub.example.com is, of course, replaced by my applet domain) Both pages can be opened respectively with http and https My serve.json:
None of the redirects seem to work. The serve version is 11.3.0 Any ideas on how to approach the issue?