Skip to content

cors #94

@Ofthestreet

Description

@Ofthestreet

Hi,

Thanks a LOT for you simple and useful tool.

I generates html pages in yacron tasks, in that html file I setup a call to the REST api to regenerate the report using XMLHttpRequest

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
                    if (this.readyState == 4) {
                        if (this.status == 200) {
                                location.reload();
                        } else {
                            window.alert("error: " + this.status + " " + this.statusText);
                        }
                    }
                };
xhttp.open("POST", "http://localhost:8181/jobs/<jobname>/start", true);

The browser isn't happy and raise a CORS error.
If I understand correctly, this cors error is due to a missing header rendered by the yacron rest api server which should add the header Access-Control-Allow-Origin in the response.

Is there a way to add this header in the embedded rest server that is aiohttp ?

I saw the module https://github.com/aio-libs/aiohttp-cors, but my usage is very simple

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions