Skip to content

Add an environment variable for disabling compression on the proxy server #13205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docusaurus/docs/proxying-api-requests-in-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ DANGEROUSLY_DISABLE_HOST_CHECK=true

We don’t recommend this approach.

## Server Sent Events (SSE) not being received by client

This may be caused due to the fact that compression is enabled on the development server. You can try disabling compression by adding the following line to `.env.development` in the root of your project:

```
WDS_COMPRESSION=false
```

## Configuring the Proxy Manually

> Note: this feature is available with `[email protected]` and higher.
Expand Down
3 changes: 2 additions & 1 deletion packages/react-scripts/config/webpackDevServer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const host = process.env.HOST || '0.0.0.0';
const sockHost = process.env.WDS_SOCKET_HOST;
const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
const sockPort = process.env.WDS_SOCKET_PORT;
const compress = process.env.WDS_COMPRESSION !== 'false';

module.exports = function (proxy, allowedHost) {
const disableFirewall =
Expand Down Expand Up @@ -50,7 +51,7 @@ module.exports = function (proxy, allowedHost) {
'Access-Control-Allow-Headers': '*',
},
// Enable gzip compression of generated files.
compress: true,
compress,
static: {
// By default WebpackDevServer serves physical files from current directory
// in addition to all the virtual build products that it serves from memory.
Expand Down