Skip to content

Commit 8cacf5e

Browse files
authored
Add destroy request call in close event to support SSE closing (#34)
### Developer Checklist (Definition of Done) **Issue** - [x] All acceptance criteria from the issue are met - [x] Tested in latest Chrome/Firefox **UI/UX/Vis** - [ ] Requires UI/UX/Vis review - [ ] Reviewer(s) are notified (_tag assignees_) - [ ] Review has occurred (_link to notes_) - [ ] Feedback is included in this PR - [ ] Reviewer(s) approve of concept and design **Code** - [x] Branch is up-to-date with the branch to be merged with, i.e., develop - [x] Code is cleaned up and formatted - [x] Unit tests are written (frontend/backend if applicable) - [x] Integration tests are written (if applicable) **PR** - [x] Descriptive title for this pull request is provided (will be used for release notes later) - [x] Reviewer and assignees are defined - [x] Add type label (e.g., *bug*, *feature*) to this pull request - [x] Add release label (e.g., `release: minor`) to this PR following [semver](https://semver.org/) - [x] The PR is connected to the corresponding issue (via `Closes #...`) - [x] [Summary of changes](#summary-of-changes) is written ### Summary of changes - Destroy the current request on close to properly close any open SSE (server side events) sessions. Otherwise, the sessions will remain open and never be closed, causing issues with the reload process hanging infinitely. ### Screenshots ### Additional notes for the reviewer(s) - Thanks for creating this pull request 🤗
2 parents 4ec289e + 658115f commit 8cacf5e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

config/webpack.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@ module.exports = (webpackEnv, argv) => {
320320
target: 'http://localhost:9000',
321321
secure: false,
322322
ws: true,
323+
// Explicitly forward close events for properly closing SSE (server-side events). See https://github.com/webpack/webpack-dev-server/issues/2769#issuecomment-1517290190
324+
onProxyReq: (proxyReq, req, res) => {
325+
res.on('close', () => proxyReq.destroy());
326+
},
323327
},
324328
'/login': {
325329
target: 'http://localhost:9000',

0 commit comments

Comments
 (0)