Skip to content

Commit d15ab57

Browse files
Remove .proxy/ from Discord Activity proxy path (#7723)
* Remove .proxy/ * Added changelog * Fix spelling * Fix Bobby tables * Add note to previous proxy change log * Update changelog
1 parent aea2046 commit d15ab57

File tree

5 files changed

+59
-15
lines changed

5 files changed

+59
-15
lines changed

docs/activities/building-an-activity.mdx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,6 @@ We can now run our server and client-side apps in separate terminal windows. You
457457
458458
Before we call your backend activity server, we need to be aware of the Discord proxy and understand how to avoid any Content Security Policy (CSP) issues.
459459
460-
:::info
461-
For this tutorial, we are going to prefix the API call to `/api/token/` with `/.proxy`, but you can also use the SDK's `patchUrlMappings()` method to automatically prefix calls to your external resources for the proxy.
462-
:::
463-
464460
Learn more about this topic in the guides for [Constructing a Full URL](/docs/activities/development-guides/networking#construct-a-full-url) and [Using External Resources](/docs/activities/development-guides/networking#using-external-resources).
465461
466462
### Calling your backend server from your client
@@ -513,10 +509,7 @@ async function setupDiscordSdk() {
513509
});
514510
515511
// Retrieve an access_token from your activity's server
516-
// Note: We need to prefix our backend `/api/token` route with `/.proxy` to stay compliant with the CSP.
517-
// Read more about constructing a full URL and using external resources at
518-
// https://discord.com/developers/docs/activities/development-guides/networking#construct-a-full-url
519-
const response = await fetch("/.proxy/api/token", {
512+
const response = await fetch("/api/token", {
520513
method: "POST",
521514
headers: {
522515
"Content-Type": "application/json",

docs/activities/development-guides/networking.mdx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ There are scenarios where instead of using a relative url (`/path/to/my/thing`)
2929
1. The protocol you wish to use
3030
2. Your application's client id
3131
3. The discord proxy domain
32-
4. The `/.proxy` path prefix
33-
5. Whatever you need to list
32+
4. Whatever you need to list
3433

3534
Here's an example of how to build a full url, using the URL constructor:
3635

@@ -39,13 +38,13 @@ const protocol = `https`;
3938
const clientId = '<YOUR CLIENT ID>';
4039
const proxyDomain = 'discordsays.com';
4140
const resourcePath = '/foo/bar.jpg';
42-
const url = new URL(`${protocol}://${clientId}.${proxyDomain}/.proxy${resourcePath}`);
41+
const url = new URL(`${protocol}://${clientId}.${proxyDomain}${resourcePath}`);
4342
```
4443

4544
In other words, given an application client id of `12345678`
46-
| Relative Path | Full Path |
47-
|---------------|-----------------------------------------------------|
48-
| /foo/bar.jpg | https://12345678.discordsays.com/.proxy/foo/bar.jpg |
45+
| Relative Path | Full Path |
46+
|---------------|----------------------------------------------|
47+
| /foo/bar.jpg | https://12345678.discordsays.com/foo/bar.jpg |
4948

5049
---
5150

docs/activities/how-activities-work.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function setup() {
4141
});
4242

4343
// Retrieve an access_token from your application's server
44-
const response = await fetch('/.proxy/api/token', {
44+
const response = await fetch('/api/token', {
4545
method: 'POST',
4646
headers: {
4747
'Content-Type': 'application/json',

docs/change-log/2024-07-17-activities-proxy-csp-update.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
title: "Activities Proxy CSP Update"
33
date: "2024-07-17"
44
breaking: true
5+
topics:
6+
- "Activities"
7+
- "Embedded App SDK"
58
---
69

10+
:::warn
11+
This change is outdated. We have since updated the Activities Proxy CSP and the use of `/.proxy/` is no longer required. For the latest information, please refer to [this changelog](/docs/change-log#remove-proxy-from-discord-activity-proxy-path).
12+
:::
13+
714
This change will be rolled out to all existing applications on **August 28, 2024**.
815

916
We will be updating our Content Security Policy (CSP) for the Activities Domain (`https://<application_id>.discordsays.com`). This represents a **breaking change** for **all Activities**, and as such we have a migration plan in order.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: "Remove .proxy/ from Discord Activity proxy path"
3+
date: "2025-07-30"
4+
topics:
5+
- "Activities"
6+
- "Embedded App SDK"
7+
---
8+
9+
We've updated the Content Security Policy (CSP) for Discord Activities to remove the `.proxy/` path requirement when making requests through the discordsays.com proxy. This change simplifies the developer experience while maintaining full backwards compatibility. This was made possible by resolving the underlying privacy considerations that originally required the `.proxy/` path restriction.
10+
11+
#### Before
12+
13+
Activities were required to make proxy requests through paths prefixed with `/.proxy/`:
14+
15+
```
16+
https://<app_id>.discordsays.com/.proxy/api/endpoint
17+
```
18+
19+
#### After
20+
21+
Activities can now make proxy requests directly without the `/.proxy/` prefix:
22+
23+
```
24+
https://<app_id>.discordsays.com/api/endpoint
25+
```
26+
27+
#### Technical Details
28+
29+
- **CSP Update**: The Content Security Policy now allows requests to `https://<app_id>.discordsays.com/*` instead of the more restrictive `https://<app_id>.discordsays.com/.proxy/*`
30+
- **Proxy Behavior**: Both URL patterns work identically - your existing proxy mappings (e.g., `/api -> example.com`) will function the same way regardless of whether you use `/.proxy/api` or `/api`
31+
- **Performance**: No performance differences between the two approaches
32+
33+
#### Developer Tooling Updates
34+
35+
The `patchUrlMappings` utility will be updated in an upcoming Embedded App SDK release to generate the simplified URLs by default, though it will continue to support the `.proxy/` format for backward compatibility.
36+
37+
#### Backward Compatibility
38+
39+
**All existing code will continue to work without changes.** The `/.proxy/` path prefix is still fully supported and will be maintained indefinitely. You can:
40+
41+
- Continue using existing `/.proxy/` URLs
42+
- Switch to the new, simplified URLs
43+
- Use both patterns simultaneously in the same application
44+
45+
**No migration is required.** This is a purely additive change that expands what's possible rather than breaking existing functionality.

0 commit comments

Comments
 (0)