-
Notifications
You must be signed in to change notification settings - Fork 2
Programming guidelines: Server
guardian.co.uk Caches components used on the site. The amount of hits on your server will depend on the Cache-Control header that you set on your component.
Decide how long the data in your component is valid for and set an appropriate value for max-age in seconds. For example if the data is valid for 5 hours you would set it for 5hours x 60minutes x 60seconds = 18000 seconds so…
Cache-Control: public, max-age=18000
If you are pulling images or other resources directly off of your servers then you need to ensure that you get an estimate of the amount of traffic you are likely to get from having the component placed on guardian.co.uk and ensure that your servers can take the load.
guardian.co.uk Does not automatically cache images or other resources that you link to directly, although it is good practice for you to set appropriate cache headers on these too.
If the call to your component returns an HTTP status of 200, then the component must have rendered properly and be suitable to view on guardian.co.uk.
Any errors that occur must be hidden from end users using an appropriate HTTP status code.
If any error occurs then the status needs to be set appropriately, for example an internal server error is 500 and if the url is incorrect (the component is not found) it should return 404.
Calls to your component must complete in less than 1 second in most cases. Calls that take longer than 5 seconds are dropped automatically.