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

Pass more information to RequestModifier #4346

Closed
WalterWoshid opened this issue Jan 7, 2024 · 2 comments
Closed

Pass more information to RequestModifier #4346

WalterWoshid opened this issue Jan 7, 2024 · 2 comments
Assignees
Milestone

Comments

@WalterWoshid
Copy link

The RequestModifier looks like this:

export function modifyRequest(httpRequest, requestModifier) {
    const request = {
        url: httpRequest.url,
        method: httpRequest.method,
        headers: Object.assign({}, httpRequest.headers),
        credentials: httpRequest.withCredentials ? 'include' : undefined,
    };

    return Promise.resolve(requestModifier.modifyRequest(request))
        .then(() =>
            Object.assign(httpRequest, request, { withCredentials: request.credentials === 'include' })
        );
}

I am trying to fetch a video source, but because of CORS errors that are not fixable, I created a proxy controller on my backend, which fetches a request (that usually results in a CORS error) and returns the result (now without the CORS error).

But trying to overload the modifyRequest is not the most optimal solution, I see that a Range header is set, but I can't access it in the extended method. Without it, my proxy controller tries to download the whole file which is sub-optimal.

A simple fix like this would be good enough for me:

    const request = {
        range: httpRequest.request.range,
        url: httpRequest.url,
@dsilhavy
Copy link
Collaborator

dsilhavy commented Jan 8, 2024

Addressed this in #4350, please check if this solves your issue

@WalterWoshid
Copy link
Author

Great, thank you very much :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants