-
-
Save marckrenn/2bb78853e02af90c5904100a15398abe to your computer and use it in GitHub Desktop.
Update by Steve Ruiz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Utils.CORSproxy = (url) -> | |
# Detect local IPv4/IvP6 addresses | |
# https://stackoverflow.com/a/11327345 | |
regexp = /(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/ | |
if regexp.test(window.location.hostname) | |
return "http://#{window.location.host}/_server/proxy/#{url}" | |
return url |
Hi marckreen. your solution works like magic.. can you help me understand what does http://#{window.location.host}/_server/proxy/#{url}
do exactly?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
else
could also fall back tohttps://crossorigin.me/#{url}
but that's probably too much magic …EDIT: crossorigin.me isn't reliable enough for my taste