Skip to content

Commit

Permalink
cors
Browse files Browse the repository at this point in the history
  • Loading branch information
Szabolcs Szabolcsi-Toth committed Jun 9, 2024
1 parent b1fd491 commit 1ad6afb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export function middleware(request) {
// retrieve the current response
const res = NextResponse.next()

console.log('middleware cors', request)
console.log('middleware cors')

// add the CORS headers to the response
res.headers.append('Access-Control-Allow-Credentials', "true")
res.headers.append('Access-Control-Allow-Origin', '*') // replace this your actual origin
res.headers.append('Access-Control-Allow-Origin', request.origin) // replace this your actual origin
res.headers.append('Access-Control-Allow-Methods', 'GET,DELETE,PATCH,POST,PUT')
res.headers.append(
'Access-Control-Allow-Headers',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const config = {

const SocketHandler = (req, res) => {
if (!res.socket.server.io) {
const path = '/api/socket'
const path = '/api/socket/'
const httpServer = res.socket.server
const io = new IOServer(httpServer, {
path,
Expand Down

0 comments on commit 1ad6afb

Please sign in to comment.