You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 11, 2022. It is now read-only.
@@ -194,20 +194,6 @@ The config file `static.json` should be committed at the root of the repo. It wi
194
194
195
195
The default `static.json`, if it does not exist in the repo, is:
196
196
197
-
```json
198
-
{ "root": "build/" }
199
-
```
200
-
201
-
### Changing the root
202
-
203
-
If a different web server `"root"` is specified, such as with a highly customized, ejected create-react-app project, then the new bundle location may need to be [set to enable runtime environment variables](#user-content-custom-bundle-location).
204
-
205
-
### Routing clean URLs
206
-
207
-
[React Router](https://github.com/ReactTraining/react-router) (not included) may easily use hash-based URLs like `https://example.com/index.html#/users/me/edit`. This is nice & easy when getting started with local development, but for a public app you probably want real URLs like `https://example.com/users/me/edit`.
208
-
209
-
Create a `static.json` file at the root of the repo to configure the web server for clean [`browserHistory` with React Router v3](https://github.com/ReactTraining/react-router/blob/v3/docs/guides/Histories.md#browserhistory) & [`BrowserRouter` with v4](https://reacttraining.com/react-router/web/api/BrowserRouter):
210
-
211
197
```json
212
198
{
213
199
"root": "build/",
@@ -217,7 +203,15 @@ Create a `static.json` file at the root of the repo to configure the web server
217
203
}
218
204
```
219
205
220
-
👓 See [custom routing w/ the static buildpack](https://github.com/heroku/heroku-buildpack-static#custom-routes).
206
+
### Changing the root
207
+
208
+
If a different web server `"root"` is specified, such as with a highly customized, ejected create-react-app project, then the new bundle location may need to be [set to enable runtime environment variables](#user-content-custom-bundle-location).
209
+
210
+
### Routing
211
+
212
+
🚥 ***Client-side routing is supported by default.** Any server request that would result in 404 Not Found returns the React app.*
213
+
214
+
👓 See [custom routing w/ the static buildpack](https://github.com/heroku/heroku-buildpack-static/blob/master/README.md#user-content-custom-routes).
221
215
222
216
### HTTPS-only
223
217
@@ -226,6 +220,9 @@ Enforce secure connections by automatically redirecting insecure requests to **h
226
220
```json
227
221
{
228
222
"root": "build/",
223
+
"routes": {
224
+
"/**": "index.html"
225
+
},
229
226
"https_only": true
230
227
}
231
228
```
@@ -235,16 +232,19 @@ Prevent downgrade attacks with [HTTP strict transport security](https://develope
235
232
```json
236
233
{
237
234
"root": "build/",
235
+
"routes": {
236
+
"/**": "index.html"
237
+
},
238
238
"https_only": true,
239
239
"headers": {
240
240
"/**": {
241
-
"Strict-Transport-Security": "max-age=7776000"
241
+
"Strict-Transport-Security": "max-age=31557600"
242
242
}
243
243
}
244
244
}
245
245
```
246
246
247
-
*`max-age` is the number of seconds to enforce HTTPS since the last connection; the example is 90-days
247
+
*`max-age` is the number of seconds to enforce HTTPS since the last connection; the example is one-year
248
248
249
249
### Proxy
250
250
@@ -273,6 +273,9 @@ Add `"proxies"` to `static.json`:
0 commit comments