mars / create-react-app-buildpack

⚛️ Heroku Buildpack for create-react-app: static hosting for React.js web apps
MIT License
3.28k stars 653 forks source link

Heroku: File upload body limit nginx configuration #136

Closed sdei-chetanb closed 6 years ago

sdei-chetanb commented 6 years ago

Hi,

Is there any way to configure the max post body size limit. Right now I am getting 403 in case if post body larger than 1 MB. I contacted Heroku as well they said

It sounds like the root of this issue is in how create-react-app handles file uploads. That buildpack is not managed by Heroku, so we don't have much control or insight into how it works. I would guess that it is configuring the underlying NGINX server to have a max file upload size (or, perhaps, the default is small). You will need to reach out to the buildpack authors to see if there is any way to configure that setting.

Can you please suggest and help. Also I tried using static.json to configure variables but it did not worked for me.

Earlier response is much appreciated.

Thanks

mars commented 6 years ago

I don't think this is possible with this buildpack. It uses another buildpack to provide Nginx, and that buildpack does not support the custom configuration you need.

I have been working on an alternative version of this buildpack that uses a different Nginx server which will allow the customization you're seeking.

Check it out: mars/crak-buildpack, i.e. create-react-app + Kong

Depending on where you're encountering this error (is it from uploading through a proxy or directly to the React app?), you'll either configure these limits as part of the Kong Plugin config or directly in the Nginx config template

divadvo commented 5 years ago

In case someone encounters this issue, I've forked both create-react-app-buildpack and heroku-static-buildpack.. With my custom buildpack you can set in static.json: "max_body_size": "10m".

https://github.com/divadvo/create-react-app-buildpack

Special thanks to @daemonsy who created the original pull request for the static buildpack