AWS S3 Integration

Hello! I am brand new to Railway and just deployed my first app. I will be using AWS S3 in order to save/serve static files. Are their any Railway specifics I should know about when it comes to content delivery? Anything specific I should add to my Django project? Specifically, I am wondering about the CORS configuration and if anyone has any idea what the proper CORS parameters are. project id is puny-wrench
7 Replies
Percy
Percy3y ago
Project ID: 206b13ca-0f29-443f-8f6e-8ad345de9d90
Lewis981
Lewis981OP3y ago
206b13ca-0f29-443f-8f6e-8ad345de9d90
jackson
jackson3y ago
would recommend checking out cloudflare, even on their free plan you can leverage their CDNs to deliver static content way faster/save you some network bills but as for in-place optimization not a ton aside from your standard compression algos which you could just do with an internal nginx server as for CORS the general idea is to have your settings kinda set like this
CORS_ALLOW_CREDENTIALS = True
CORS_ALLOWED_ORIGINS = [
'your-domain.something.com',
...
]
CORS_ALLOW_CREDENTIALS = True
CORS_ALLOWED_ORIGINS = [
'your-domain.something.com',
...
]
everything else should work by default if you have the module installed
Lewis981
Lewis981OP3y ago
Sweet, I will take a look at Cloudflare. May be a simpler option! And beautiful, it looks like AWS has their own place on the website to set up CORD credentials. It looks like your suggestion would live in my website settings rather than AWS?
jackson
jackson3y ago
ah you're referencing S3 CORS, in that case I'd say try setting it to just your site's url, and if you notice bugginess there, set it to accept any origin i'm not sure what django's behavior there is, i think it should proxy the client requests thru your app if you're using serverside rendering
Lewis981
Lewis981OP3y ago
Yes I have a decent idea of the Django side, I have never used AWS before or Railway so i just wanted to double check i wasn't missing any steps. I believe you have set me up for success, thank you!
jackson
jackson3y ago
For sure, best of luck
Want results from more Discord servers?
Add your server