I have a nodejs backend and a reactjs frontend. I am using the gcloud flex environment (app engine) and want to serve all the frontend files using a CDN. I would not want the requests to touch my nodejs server. I am unable to configure my projects app.yaml to do the same.
I suspect that my requests are not being served from a CDN because if I comment the below line in my nodejs code, I can no longer access index.html .
app.use('/', express.static(path.resolve('./frontend/dist')));
Below is the YAML file.
handlers:
- url: /(.*.html)
mime_type: text/html
static_files: frontend/dist/1
upload: frontend/dist/(.*.html)
- url: /styles/(.*.css)
mime_type: text/css
static_files: frontend/dist/styles/1
upload: frontend/dist/styles/(.*.css)
- url: /scripts/(.*.js)
mime_type: text/javascript
static_files: frontend/dist/scripts/1
upload: frontend/dist/scripts/(.*.js)
- url: /images/(.*.(bmp|gif|ico|jpeg|jpg|png))
static_files: frontend/dist/images/1
upload: frontend/dist/images/(.*.(bmp|gif|ico|jpeg|jpg|png))
- url: /
static_files: frontend/dist/index.html
upload: frontend/dist/index.html
- url: /.*
script: IGNORED
secure: always
Is there a way to configure app engine such that the static file requests don't react my nodejs backend servers?
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…