mirror of
https://github.com/rustdesk/doc.rustdesk.com.git
synced 2026-06-17 14:11:38 +00:00
add missing cors bypass for RustDesk public web client
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -450,6 +450,27 @@ server {
|
||||
If you have previously deployed for web clients and want to use it across all platforms, you need to add `proxy_read_timeout`.
|
||||
{{% /notice %}}
|
||||
|
||||
#### 9. Bypass CORS if using RustDesk public web client `https://rustdesk.com/web`
|
||||
|
||||
You need to add below in the `location /` section of the `/etc/nginx/.../rustdesk.conf` to bypass CORS limitation of browsers. Skip this step if you are using your own web client.
|
||||
|
||||
```
|
||||
if ($http_origin ~* (https?://(www\.)?rustdesk\.com)) {
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
}
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
add_header 'Content-Length' 0;
|
||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
return 204;
|
||||
}
|
||||
```
|
||||
|
||||
### SELinux
|
||||
|
||||
|
||||
Reference in New Issue
Block a user