How to solve cors problem?

Hello, I have a problem with my app.
I’m developing based on openvidu-call-ionic example and Deploying Openvidu on premises.
I am wondering how to solve the cors problem. Please let me know if it can be solved by openvidu or ionic.
If you need to check the log file, please tell me which file you need.

According to the document, I have to change header like this?
this file is

createSession(sessionId: string, openviduServerUrl: string, openviduSecret: string) {
        return new Promise((resolve, reject) => {
            const body = JSON.stringify({ customSessionId: sessionId });
            const options = {
                headers: new HttpHeaders({
                    'Authorization': 'Basic ' + btoa('OPENVIDUAPP:' + openviduSecret),
                    'Content-Type': 'application/json',
                    'Access-Control-Allow-Origin': "*",
                    'Access-Control-Allow-Methods': "GET,POST"
            return this.http
                .post<any>(openviduServerUrl + '/api/sessions', body, options)
                    catchError((error) => {
                        error.status === 409 ? resolve(sessionId) : reject(error);
                        return observableThrowError(error);
                .subscribe((response) => {

I don’t know how your app and your backend is, you need to know what is CORS and how solve it. But this is not about OpenVidu.


ok. thanks for your answer.

If you set header in backend then no need to change on front-end

I set up this, Deploying OpenVidu on premises, isn’t it the backend part??
It is difficult because it’s my first time doing openvidu and ionic…

if you are calling openvidu call then it has nodejs inside docker. becuase i done same thing for one of my client

1 Like

I have to check that. Thank you!

Did you solve the problem? i’m facing the same issue