-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: send Referer header on ios #3210
Comments
The alternative doesn't work for loading images in an Here is the code I wrote for the alternative. It shows an error on android, as it's not allowing setting the referer. On iOS, it silently fails to add the referer.
|
Has anyone discovered or proposed any alternatives? |
you can try https://github.com/capacitor-community/http as a replacement for window.XMLHttpRequest |
@jayenashar i will. thank you for the suggestion. |
#6387 this could fix the problem |
need this too, for domain-restricted external images,raster map tiles in particular |
For those who can't set self.Request = class extends Request {
headers = new Headers()
constructor(body, initParams) {
super(body, initParams)
this.headers = new Headers(initParams?.headers)
}
} Use const output = await fetch("https://google.com", {
headers: { referer: "https://google.com" }
})
.then(res => res.arrayBuffer()) With this patch I can even enable
|
Anyone actually found a workaround that works for iOS? |
I need this too! Is there any working workaround? |
I am using axios which uses XMLHttpRequest internally, which works fine on android but do not work on iOS at the moment, my versions are; "@capacitor/android": "^6.0.0",
"@capacitor/app": "^6.0.0",
"@capacitor/app-launcher": "^6.0.0",
"@capacitor/assets": "^2.0.4",
"@capacitor/browser": "^6.0.0",
"@capacitor/camera": "^6.0.0",
"@capacitor/core": "^6.0.0",
"@capacitor/device": "^6.0.0",
"@capacitor/filesystem": "^6.0.1",
"@capacitor/ios": "^6.0.0",
"@capacitor/preferences": "^6.0.0", |
I am unable to use Bing Maps with a security-enabled API key because of this issue. Are there any plans to fix this soon? |
Let's fork this library and modify the swift code |
Feature Request
Description
Hello, I am using a service that secures web apps using the HTTP Referer header. This service does allow the capacitor:// scheme which is default on iOS. I am having an issue were capacitor on iOS is not sending the header, even though it does send the Origin header and other headers. The service offers a js npm module which uses XMLHttpRequest. I am not having issues on Android.
Platform(s)
iOS
Preferred Solution
Add the HTTP Referer header to XMLHttpRequests.
Alternatives
Overriding XMLHttpRequest to inject the header. (Haven't tried it, yet.)
Additional Context
Attached safari debugger and found this:
The text was updated successfully, but these errors were encountered: