Skip to content
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

dev-server handles relative redirects without crashing. #118

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

tdilauro
Copy link
Contributor

Description

Let's the dev-server properly handle redirects to relative URLs.

Motivation and Context

Previously, redirects to relative URLs cause the `dev-server to crash like this:

node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:405:5)
    at new URL (node:internal/url:676:13)
    at rewriteLocationHeader (/Users/Shared/src/tpp/circulation-admin/webpack.dev-server.config.js:70:25)
    at /Users/Shared/src/tpp/circulation-admin/webpack.dev-server.config.js:176:9
    at IncomingMessage.<anonymous> (/Users/Shared/src/tpp/circulation-admin/node_modules/http-proxy-middleware/dist/handlers/response-interceptor.js:24:57)
    at IncomingMessage.emit (node:events:529:35)
    at endReadableNT (node:internal/streams/readable:1400:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  input: '/relative/url',
  code: 'ERR_INVALID_URL'
}

How Has This Been Tested?

Manually tested locally, redirecting to both relative and absolute URLs.

Checklist:

  • N/A - I have updated the documentation accordingly.
  • N/A - All new and existing tests passed.

@tdilauro tdilauro requested a review from ray-lee June 22, 2024 17:55
Copy link
Contributor

@ray-lee ray-lee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@tdilauro tdilauro merged commit e05491f into main Jun 27, 2024
1 check passed
@tdilauro tdilauro deleted the bugfix/dev-server-handle-relative-redirect branch June 27, 2024 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants