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

use explicit protocol when replacing links in documents from proxies #1358

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

reykjavikingur
Copy link

This is a change to how links are rewritten when proxying a site that serves responses on both "http" and "https" protocols but does not necessarily have functional consistency between the two. Specifically, all URL's that the proxy rewrites would include the protocol, rather than being protocol-relative. That is, they would start with "http://" or "https://" rather than "//". Rewritten links would always have the same protocol as the proxy target. This is mainly to solve an issue that I'm facing in the case of a proxied site has an inline script where it puts its full origin in a variable, which is subsequently used to construct API endpoints by JS functions whose parsing logic expects the URL in that variable to have an explicit protocol. In general, I suggest that explicit protocols in rewritten links is a functional improvement for the browser-sync proxy, because it avoids conflating protocols when proxying targets that are part of a dual-protocol site with protocol-specific functionality.

@coveralls
Copy link

coveralls commented Apr 14, 2017

Coverage Status

Coverage increased (+0.003%) to 95.405% when pulling acec671 on reykjavikingur:master into cbe2ccb on BrowserSync:master.

@mwld
Copy link

mwld commented Feb 22, 2018

@reykjavikingur Any plans on finishing this one?

From what I can see the build is succeeding in Node v6 but failing in Node v4 and below. This might be due to missing ES6 feature support in those versions: https://ci.appveyor.com/project/shakyShane/browser-sync/build/1.0.1352

@reykjavikingur
Copy link
Author

I'll resume working on this soon.

@reykjavikingur
Copy link
Author

I merged the latest into my fork and refactored proxy utils and unit tests.

@reykjavikingur
Copy link
Author

The functional issue that I was having in browser-sync v2.18 is no longer happening in v2.26, so I'll close this PR, as it no longer seems necessary.

@reykjavikingur
Copy link
Author

Never mind. The issue is still happening after all. I'd like to reopen this PR for your consideration.

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.

None yet

3 participants