guzba / mummy

An HTTP and WebSocket server for Nim that returns to the ancient ways of threads.
MIT License
274 stars 10 forks source link

Same Origin Policy #94

Closed choltreppe closed 1 year ago

choltreppe commented 1 year ago

It seems like mummy doesn't check a requests origin (?). This would be nice to have.

guzba commented 1 year ago

I am not sure exactly what you're requesting, could you explain a bit more about what you mean?

If you mean checking the Origin header, this will not be something Mummy will do. You should do that in a layer of your own Handler code. Mummy does not know the set of valid Origin values, nor does Mummy know what response you want to send in the case it is not valid.

I would have a Handler that checks this Origin header, then calls on to the next Handler when this check is required. Something a bit like https://github.com/guzba/mummy/blob/master/examples/custom_handler_params.nim.

Closing this for now. Feel free to re-open if I've misunderstood the request.