Currently, I'm doing it with nginx:
location /api {
proxy_pass http://my_app:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
client_max_body_size 1000M;
server_tokens off;
is there a way to configure it on the s3bucket I created?
No, you cannot proxy a path to another server within S3, that only supports static objects served by S3 directly.
But you can handle this in Cloudfront by adding an extra behaviour which points to your other instance/port see https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-distribution-serve-content/