Skip to content

Commit 841df1e

Browse files
committed
Update docs
1 parent a94b542 commit 841df1e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/guides/basics/Histories.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Browser history is the recommended history for browser application with React Ro
3939
#### Configuring Your Server
4040
Your server must be ready to handle real URLs. When the app first loads at `/` it will probably work, but as the user navigates around and then hits refresh at `/accounts/23` your web server will get a request to `/accounts/23`. You will need it to handle that URL and include your JavaScript application in the response.
4141

42-
A quick example with express:
42+
An express app might look like this:
4343

4444
```js
4545
const express = require('express')
@@ -52,15 +52,15 @@ app.use(express.static(__dirname + '/public'))
5252

5353
// handle every other route with index.html, which will contain
5454
// a script tag to your application's JavaScript file(s).
55-
app.get('*', function(request, response){
55+
app.get('*', function (request, response){
5656
response.sendFile(path.resolve(__dirname, 'public', 'index.html'))
5757
})
5858

5959
app.listen(port)
6060
console.log("server started on port " + port)
6161
```
6262

63-
A quick example with nginx:
63+
If you're using nginx, use the [`try_files` directive](http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files):
6464

6565
```
6666
server {
@@ -71,6 +71,8 @@ server {
7171
}
7272
```
7373

74+
This lets nginx serve static asset files and serves your `index.html` file when another file isn't found on the server.
75+
7476
#### IE8, IE9 Support
7577
We feature detect to see if we can use the browser's native `window.history` API. If not, any call to transition around the app will result in _a full page reload_, which allows you to build your app and have a better experience for newer browsers, but still support old ones.
7678

0 commit comments

Comments
 (0)