-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binary Endpoints #1462
Comments
I found a nice workaround. For serving images, we need a caching reverse proxy anyway, so we could use it for setting the
This has the additional benefit, that we can share URLs of the form This approach does not use the |
@pkel Nice nginx snippet. I think that would be good for the how-to in PostgREST/postgrest-docs#307. I see what you mean about
Ideally, we would detect the
This option would be simpler to implement, seems configurator-pg would allow us to specify something like this in the config:
The config option name could take another name, but that would be the main idea. |
@Dansvidania You did some work on raw-media-types before. Would you be interested in taking this one?(no rush since there's a workaround) |
Thanks for bringing it to my attention. I'm going to check what I can do. |
@steve-chavez What is the expected relation between I imagine for example
instead of
|
@Dansvidania I think we should aim at replacing Also, we should deprecate |
I tried to setup an endpoint for providing binary data. My main motivation is to serve images for
<img>
tags without javascript. I documented my progress in a PR on the documentation repo.There is one remaining issue. The
raw-media-types
option is not powerful enough to provide a transparent binary endpoint that behaves like a webserver serving files. Firefox sendson
<img>
requests andon navigation requests (e.g. user does right click view image).
I tried the following settings:
*/*
. Navigation requests for regular json endpoints fail with*/* requested but more than one column was selected
.image/webp
. Same problem.image/*
. Does not work for<img>
requests.From my unprivileged point of view, I see two ways forward:
raw-media-endpoint
configuration option that triggers raw output for the specified tables, views, and procedures.response.raw
that allows to trigger raw output for a single request with something likeperform set_config('response.raw', 'true', true);
.The second variant can emulate the first via
pre-request
. The first would suffice for my use case.The text was updated successfully, but these errors were encountered: