Skip to main content

How can I force a PDF download with Platform.sh?

Comments

1 comment

  • Larry

    You can set headers for static files in your .platform.app.yaml file.

    In this specific case, you would include something like this:

    web:
        locations:
            '/':
                # ...
                rules:
                    \.pdf$:
                        headers:
                          Content-Type: application/octet-stream
                          Content-Disposition: attachment
    

    See the documentation for further examples.

    For files served through your application rather than statically you would need to set the same headers from your application code.

    0

Please sign in to leave a comment.