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

fix(gatsby): Proxy non-200 HTTP responses #36590

Closed

Conversation

jsalvata
Copy link

@jsalvata jsalvata commented Sep 11, 2022

Transfer errors responses from the proxied server, including the status code, to the client.

Credit for the solution to dangkyokhoang, who provided it here.

Description

Documentation

Related Issues

Fixes #36589, aka #34244, aka #33333.

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 11, 2022
@LekoArts LekoArts added topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine) and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Sep 12, 2022
@LekoArts LekoArts changed the title fix: proxy non-200 http responses fix(gatsby): Proxy non-200 HTTP responses Sep 12, 2022
@LekoArts
Copy link
Contributor

Hi, thanks for the PR!

Linting is complaining about two things:

  564:21  error  Replace `response·=·err.response` with `(response·=·err.response)`  prettier/prettier
  564:21  error  Expected a conditional expression and instead saw an assignment     no-cond-assign

And I agree that this line here is incorrect:

if (response = err.response) {

You shouldn't do an assignment inside this expression. I think you just need to change the other line to

res.end(error.response.rawBody)

Please try that out

@LekoArts LekoArts added the status: awaiting author response Additional information has been requested from the author label Sep 12, 2022
@jsalvata jsalvata force-pushed the jsalvata-patch-proxy-http-errors branch from f5c76b2 to c26b508 Compare October 3, 2022 09:37
Transfer errors responses from the proxied server, including the status code, to the client.

Fixes gatsbyjs#36589, aka gatsbyjs#34244, aka gatsbyjs#33333.
@jsalvata jsalvata force-pushed the jsalvata-patch-proxy-http-errors branch from c26b508 to d576230 Compare October 13, 2022 09:45
@jsalvata
Copy link
Author

Sorry I can't find time to work on this.

@jsalvata jsalvata closed this Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: awaiting author response Additional information has been requested from the author topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The development proxy does not transfer non-200 HTTP codes and responses
2 participants