| 1 |
# Datasette running behind an Apache proxy |
| 2 |
|
| 3 |
See also [Running Datasette behind a proxy](https://docs.datasette.io/en/latest/deploying.html#running-datasette-behind-a-proxy) |
| 4 |
|
| 5 |
This live demo is running at https://datasette-apache-proxy-demo.fly.dev/prefix/ |
| 6 |
|
| 7 |
To build locally, passing in a Datasette commit hash (or `main` for the main branch): |
| 8 |
|
| 9 |
docker build -t datasette-apache-proxy-demo . \ |
| 10 |
--build-arg DATASETTE_REF=c617e1769ea27e045b0f2907ef49a9a1244e577d |
| 11 |
|
| 12 |
Then run it like this: |
| 13 |
|
| 14 |
docker run -p 5000:80 datasette-apache-proxy-demo |
| 15 |
|
| 16 |
And visit `http://localhost:5000/` or `http://localhost:5000/prefix/` |
| 17 |
|
| 18 |
## Deployment to Fly |
| 19 |
|
| 20 |
To deploy to [Fly](https://fly.io/) first create an application there by running: |
| 21 |
|
| 22 |
flyctl apps create --name datasette-apache-proxy-demo |
| 23 |
|
| 24 |
You will need a different name, since I have already taken that one. |
| 25 |
|
| 26 |
Then run this command to deploy: |
| 27 |
|
| 28 |
flyctl deploy --build-arg DATASETTE_REF=main |
| 29 |
|
| 30 |
This uses `fly.toml` in this directory, which hard-codes the `datasette-apache-proxy-demo` name - so you would need to edit that file to match your application name before running this. |
| 31 |
|
| 32 |
## Deployment to Cloud Run |
| 33 |
|
| 34 |
Deployments to Cloud Run currently result in intermittent 503 errors and I'm not sure why, see [issue #1522](https://github.com/simonw/datasette/issues/1522). |
| 35 |
|
| 36 |
You can deploy like this: |
| 37 |
|
| 38 |
DATASETTE_REF=main ./deploy-to-cloud-run.sh |