diff --git a/src/be/jeffcheasey88/peeratcode/framework/Router.java b/src/be/jeffcheasey88/peeratcode/framework/Router.java index 272bb82..50d8f3c 100644 --- a/src/be/jeffcheasey88/peeratcode/framework/Router.java +++ b/src/be/jeffcheasey88/peeratcode/framework/Router.java @@ -62,7 +62,10 @@ public class Router{ for(Entry routes : this.responses.get(type).entrySet()){ Matcher matcher = this.patterns.get(routes.getKey()).matcher(path); if(matcher.matches()){ - if(user == null && routes.getValue().needLogin()) return; + if(user == null && routes.getValue().needLogin()){ + HttpUtil.responseHeaders(writer, 401, "Access-Control-Allow-Origin: *"); + return; + } if(routes.getValue().websocket()){ HttpUtil.switchToWebSocket(reader, writer); reader = new WebSocketReader(reader);