hackliberty-conf/swag/nginx/include.d/mjolnir-reports.conf
2023-05-26 18:25:19 +00:00

20 lines
1.1 KiB
Plaintext

location ~ ^/_matrix/client/r0/rooms/([^/]*)/report/(.*)$ {
# Abuse reports should be sent to Mjölnir.
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
include /config/nginx/include.d/synapse-proxy.conf;
set $upstream_app mjolnir;
set $upstream_port 8081;
set $upstream_proto http;
# Add CORS, otherwise a browser will refuse this request.
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
add_header 'Access-Control-Max-Age' 1728000;
# Alias the regexps, to ensure that they're not rewritten.
set $room_id $1;
set $event_id $2;
proxy_pass $upstream_proto://$upstream_app:$upstream_port/api/1/report/$room_id/$event_id;
}