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

Send the Origin, not X-Forwarded-Host, HTTP header with API requests #83

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

stevegrunwell
Copy link
Contributor

Within the WP101 Plugin app, we need to know what domain the plugin is running on so that we may ensure the correct videos are getting served.

For the longest time, we've been using X-Forwarded-Host, but this header will get overwritten on systems leveraging any sort of load balancer or other proxy. The proper header in this case is Origin. From MDN:

The Origin request header indicates the origin (scheme, hostname, and port) that caused the request. For example, if a user agent needs to request resources included in a page, or fetched by scripts that it executes, then the origin of the page may be included in the request.

Within the WP101 Plugin app, we need to know what domain the plugin is running on so that we may ensure the correct videos are getting served.

For the longest time, we've been using `X-Forwarded-Host`, but this header will get overwritten on systems leveraging any sort of load balancer or other proxy. The **proper** header in this case is `Origin`. [From MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin):

> The `Origin` request header indicates the origin (scheme, hostname, and port) that caused the request. For example, if a user agent needs to request resources included in a page, or fetched by scripts that it executes, then the origin of the page may be included in the request.
@stevegrunwell stevegrunwell self-assigned this May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant