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(dev): Do not change origin on proxy in dev #9066

Merged
merged 3 commits into from
Aug 31, 2023

Conversation

dac09
Copy link
Collaborator

@dac09 dac09 commented Aug 25, 2023

Fixes #7811

What does this do?

See issue for an explanation, but in essence:

  1. Allows any host to connect (localhost, 127.0.0.1, myCustom.host) by setting host to true https://vitejs.dev/config/server-options.html#server-host

  2. Does not change the origin when proxying requests to the api side.


Incase there's interest to try this, this is the api function I used to debug (based on issue instructions):

import type { APIGatewayEvent, Context } from 'aws-lambda'

import { logger } from 'src/lib/logger'

export const handler = async (event: APIGatewayEvent, _context: Context) => {
  logger.info(`${event.httpMethod} ${event.path}: checkHost function`)

  return {
    statusCode: 200,
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      host: event.headers.host,
    }),
  }
}

@dac09 dac09 added the release:fix This PR is a fix label Aug 25, 2023
@dac09 dac09 added this to the next-release-patch milestone Aug 25, 2023
@dac09 dac09 changed the title fix(dev): Do not change origin on proxy fix(dev): Do not change origin on proxy in dev Aug 25, 2023
@thedavidprice
Copy link
Contributor

@dac09 is there direction for testing/QA here? E.g for a reviewer how could someone confirm this does not break behavior?

Please loop in either Josh or Tobbe for review. Thanks!

@dac09
Copy link
Collaborator Author

dac09 commented Aug 30, 2023

@dac09 is there direction for testing/QA here? E.g for a reviewer how could someone confirm this does not break behavior?

Yep in the description of this PR and the original issue :)

@Tobbe, @Josh-Walker-GM review please?

Copy link
Collaborator

@Josh-Walker-GM Josh-Walker-GM 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 and testing locally worked great.

@dac09 dac09 enabled auto-merge (squash) August 31, 2023 04:40
@dac09 dac09 merged commit f0b3baf into redwoodjs:main Aug 31, 2023
29 checks passed
@jtoar jtoar modified the milestones: next-release-patch, v6.1.1 Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix This PR is a fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug?]: Vite plugin discards the original host header when proxying requests to the API port
4 participants