angularjs - Getting CORS node-http-proxy to respond 200 to OPTIONS -
i trying web page running on :9000 make request reverse proxy running in node on :8080 accept requests if on same domain. have learned different port == different domain, options requests sent. server comes 401 unauthorized, , angular's http client gets response no data, no code console error "invalid http status code 401 unauthorized".
i want reverse proxy act if on same domain , "ok" these options requests.
it responsibility of reverse proxy respond options request expected cors headers. can provide more details on node reverse proxy. express based ?
these headers need respond (your use case may vary needed in recent project):
res.setheader('access-control-allow-origin', 'whatever.com:9000'); res.setheader('access-control-allow-headers', 'content-type'); res.setheader('access-control-allow-credentials', true); // dont want 1 unless there auth/cookies involved res.setheader('access-control-allow-methods', 'get,patch,post,put,delete');
ReplyDeleteHi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer Node js Training in Chennai . learn from or Javascript Online Training from India. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai