CORS

Scott van Kalken scottvankalken at gmail.com
Thu Dec 16 01:00:45 UTC 2021


.....including the mailing list this time :)


On Thu, 16 Dec 2021 at 11:59, Scott van Kalken <scottvankalken at gmail.com>
wrote:

> Hey Valentin,
>
> I don't know what everyone else would like to do with respect to CORS, but
> I have found a number of use cases where it would be helpful to be able to
> set response headers.
>
> Now, there are two things that I can think of here.
> If this is for an actual application - I should be able to set response
> headers in my application, so why would I ever need to explicitly do this
> in unit?
>
> Something like this:
>
> @app.route('/hello', methods=["POST"])def hello():
>     resp = make_response(render_template('hello.html'))
>     resp.headers['Access-Control-Allow-Origin'] = '*'
>     return resp
>
>
> If I do that then everything should be fine.
>
> Where this falls down is use case #2 where I want to talk to the unit
> server itself, or where I have a compiled application and don't necessarily
> have the source code.
>
> The one that I've been focussed on recently is the "I want to talk to the
> unit server itself". I've been playing around with visualising the unit
> configuration, starting with some VUE bits - and also using the tree
> animation from here:
> https://philogb.github.io/jit/static/v20/Jit/Examples/Spacetree/example1.html
> (I've been a fan of Nicolas' for some time).
>
> This got me thinking on the wider concepts of CORS headers.
>
> I am still in two minds as to whether unit itself should have this
> capability or whether there should be an expectation that the application
> does this.
>
> Open to thoughts on this - because I think it's an interesting area.
>
> Scott.
>
>
>
>
>
>
> On Tue, 14 Dec 2021 at 00:01, Valentin V. Bartenev <vbart at nginx.com>
> wrote:
>
>> On Wednesday, 8 December 2021 03:25:10 MSK Scott van Kalken wrote:
>> > Hey all,
>> >
>> > wondering about handling CORS. East to do with NGINX but i’m wondering
>> what
>> > the story is with doing this in unit without fronting unit with NGINX.
>> >
>> > Is the ability to set headers for CORS available today or is it planned
>> yet?
>> >
>>
>> Hi,
>>
>> Unfortunately, there's no way to alter response header fields in Unit yet.
>> Yes, this feature definitely is in our todo.
>>
>> If you have any idea about how the relevant configuration should look
>> like,
>> please feel free to share.
>>
>>   wbr, Valentin V. Bartenev
>>
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/unit/attachments/20211216/1242f6ae/attachment.htm>


More information about the unit mailing list