#2697 Access-Control-Allow-Origin with Wisp

jhughes Mon 21 May 2018

Is there a way to configure a Wisp server to properly handle the Access-Control-Allow-Origin scenario?

SlimerDude Mon 21 May 2018

Is there a way to configure a Wisp server to handle Access-Control-Allow-Origin?

Of course, just set the WebRes header value to whatever you need:

res.header["Access-Control-Allow-Origin"] = "http://domain1.com, http://domain2.com"

But if by the highlighted words:

Is there a way to configure a Wisp server to properly handle the XXXX scenario?

you actually mean, "Is there a CORS plugin / webmod for Wisp?" then no.

I did think about writing one once, but CORS is really just a lot of configuration, setting a few HTTP headers, and very little logic. To then make a plugin that's configurable enough for all use cases, I quickly realised that managing the plugin config would probably be more complicated to the end developer than setting the headers themselves!

But if you have concrete ideas to the contrary, it'd be good to hear them.

jhughes Tue 22 May 2018

I was specifically hitting a CORS issue with this and setting the header didn't seem to matter. The request was coming via a proxy so i'm not sure if the issue was actually with the proxy or not. At this point I have changed so much in my server's architecture for this scenario I can't even recreate the issue anymore so it's hard for me to give much more feedback on the topic until I come across it again.

Login or Signup to reply.