# Simple proxy handler, used by the front-end RESTBase to proxy requests to
# the AQS backend. Pulled in by projects/wikimedia.org.yaml.

paths:
  /per-article/{+rest}:
    get:
      x-request-handler:
        - get_from_backend:
            request:
              uri: '{{options.host}}/pageviews/per-article/{+rest}'

  /per-project/{+rest}:
    get:
      x-request-handler:
        - get_from_backend:
            request:
              uri: '{{options.host}}/pageviews/aggregate/{+rest}'

  /top/{+rest}:
    get:
      x-request-handler:
        - get_from_backend:
            request:
              uri: '{{options.host}}/pageviews/top/{+rest}'

# Simple proxy handler, used by the front-end RESTBase to proxy requests to
# the AQS backend. Pulled in by projects/wikimedia.org.yaml.

paths:
  /per-article/{+rest}:
    get:
      x-request-handler:
        - get_from_backend:
            request:
              uri: '{{options.host}}/pageviews/per-article/{+rest}'
            return:
              status: '{{get_from_backend.status}}'
              headers: '{{merge(get_from_backend.headers, {"cache-control":"s-maxage: 86400, max-age: 86400"})}}'
              body: '{{get_from_backend.body}}'

  /per-project/{+rest}:
    get:
      x-request-handler:
        - get_from_backend:
            request:
              uri: '{{options.host}}/pageviews/aggregate/{+rest}'
            return:
              status: '{{get_from_backend.status}}'
              headers: '{{merge(get_from_backend.headers, {"cache-control":"s-maxage: 86400, max-age: 86400"})}}'
              body: '{{get_from_backend.body}}'

  /top/{+rest}:
    get:
      x-request-handler:
        - get_from_backend:
            request:
              uri: '{{options.host}}/pageviews/top/{+rest}'
            return:
              status: '{{get_from_backend.status}}'
              headers: '{{merge(get_from_backend.headers, {"cache-control":"s-maxage: 86400, max-age: 86400"})}}'
              body: '{{get_from_backend.body}}'

Add cache headers in pageviews responses
Add cache headers in pageviews responses

Per Nuria, the analitics team is planning to publish a blog post on pageviews
next week, and would like to have caching active before then. They don't have
time to implement this in AQS, so I'm adding those headers in the
pageviews_proxy response.

Task: https://phabricator.wikimedia.org/T119886
