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

WIP: [LocalProxy - CORS] Proxy requests using the local server #376

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

Conversation

edunad
Copy link

@edunad edunad commented Jun 12, 2019

Android only, improvements are welcome!

So far I've seen the ability to proxy requests using a known ip, this was not suitable for me.
Now you can perform http://localhost/_local_proxy_/<link_here> and it will proxy the request to <link_here>, as well as injecting some CORS headers.

Ideally you would want : localproxy:// instead, but had problems implementing a custom schema

Example :

<audio id='TEST' src='http://localhost/_local_proxy_/https://raw.githubusercontent.com/tgstation/tgstation/master/sound/magic/magic_missile.ogg'></audio>

Result:

Sorry if this is already possible, could not find it :(

Related to: #230 (iOS only), #227 and #47

@edunad
Copy link
Author

edunad commented Jun 12, 2019

Just found few issues, will open again when fixed :)

@edunad edunad closed this Jun 12, 2019
@edunad
Copy link
Author

edunad commented Jun 13, 2019

Trying to fix the range issue, it seems if you skip the stream ahead, it will create a loop :P

@edunad edunad reopened this Jun 13, 2019
@edunad edunad changed the title feat(LocalProxy - CORS) Proxy requests using the local server [LocalProxy - CORS] Proxy requests using the local server Jun 13, 2019
NiklasMerz added a commit to GEDYSIntraWare/cordova-plugin-ionic-webview that referenced this pull request Nov 28, 2019
@NiklasMerz
Copy link
Contributor

Great job @edunad ! I am trying to integrate your PR in my version for Android. Did you try using the proxy for POST requests? I did not find out how to get this working, yet.

@edunad
Copy link
Author

edunad commented Nov 28, 2019

@NiklasMerz Thanks! Sadly my java android knowledge is kinda limited, i expected the ionic team to give a hand into solving the issues i've encountered (specifically with PARTIAL CONTENT). I haven't tried POST but i suspect it would work fine, since it's just appending the CORS into the response headers

@NiklasMerz
Copy link
Contributor

The problem with POST is that it does not pass the body through the proxy. I need a way to do that. The WebResourceRequest class is kind of limited. I will probably figure that out. Thank you for starting this.

@tryhardest tryhardest mentioned this pull request Mar 31, 2020
@yelhouti
Copy link

I can confirm that range requests are not supported correctly + the curent implementation breaks video playback, please either drop support, and support it correctly.

@edunad edunad changed the title [LocalProxy - CORS] Proxy requests using the local server WIP: [LocalProxy - CORS] Proxy requests using the local server Jan 2, 2021
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.

3 participants