Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

cors #63

Open
matzrm opened this issue Feb 5, 2018 · 1 comment
Open

cors #63

matzrm opened this issue Feb 5, 2018 · 1 comment

Comments

@matzrm
Copy link

matzrm commented Feb 5, 2018

how can I add cors information to header?

@ivancho98
Copy link

ivancho98 commented Aug 24, 2019

Hey, you can do this in the code replying for every endpoint the method OPTIONS:

`

 if (req->method() == qhttp::EHTTP_OPTIONS)
  {
    resp->addHeader("Access-Control-Allow-Origin", "*");

    resp->addHeader("Access-Control-Allow-Methods", "GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS");

    resp->addHeader("Access-Control-Allow-Headers", "Content-Type, Origin, Accept, Authorization, Content-Length, X-Requested-With");

    resp->setStatusCode(qhttp::ESTATUS_OK);

    resp->end();

    return;
  }

`
and you also have to add the same headers in your replies.

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

No branches or pull requests

2 participants