A little experiment in nginx rewrites. Any request for an actual directory
within site gets served the index.html page. The client side is responsible
for loading data.json from the requested directory and rendering (I'm using
react). The client will also implement history management to avoid full-page
refreshes.
Last active
August 29, 2015 14:13
-
-
Save andyvanee/ba69a8f8795300940706 to your computer and use it in GitHub Desktop.
Front-controller style static HTML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| error_page 404 /index.html; | |
| location / { | |
| if (-d $document_root$uri) { | |
| rewrite ^ /index.html break; | |
| } | |
| } | |
| location /admin/ { | |
| proxy_pass http://127.0.0.1:9543; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| . | |
| ├── Makefile | |
| ├── app | |
| │ └── admin.py | |
| ├── bower.json | |
| ├── bower_components | |
| │ ├── ... | |
| ├── nginx.conf | |
| └── site | |
| ├── collections | |
| │ ├── data.json | |
| │ └── item-one | |
| │ ├── data.json | |
| │ └── ... | |
| ├── images | |
| │ ├── data.json | |
| │ └── ... | |
| ├── index.html | |
| ├── data.json | |
| ├── app.js | |
| ├── main.css | |
| └── lib.min.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment