rethinkdb / horizon

Horizon is a realtime, open-source backend for JavaScript apps.
MIT License
6.78k stars 349 forks source link

Refused to set unsafe header "sec-websocket-version" #864

Open vignestion opened 7 years ago

vignestion commented 7 years ago

I don't know why this poping up and my whole real time functionality is not working ... Ok First I got this error websocket not defined I fixed it by setting it global variable And after that i got bunch of errors like this

Loo this screenShot

Error Screen Shot

import express from 'express';

import bodyParser from 'body-parser';

import {Server} from 'http'; import React from 'react'; import {renderToString} from 'react-dom/server'; import {match, RouterContext} from 'react-router'; import routes from '../client/routes';

import Helmet from 'react-helmet'; import compression from 'compression'; import favicon from 'serve-favicon';

import {createStore} from 'redux'; import {Provider} from 'react-redux'; import reducer from '../client/reducers' import path from 'path'

import passport from 'passport'; import config from './Auth'; import r from 'rethinkdb'; import uuid from 'node-uuid'; import Jimp from 'jimp'; import AWS from 'aws-sdk'; const JWTPASS = 'NONOE'; import horizon from '@horizon/server' let cookieParser = require('cookie-parser'); import jwt from 'jsonwebtoken'; import {forEachOf} from 'async'; import _ from 'underscore'; import xssFilters from 'xss-filters'

const FacebookStrategy = require('passport-facebook').Strategy; const TwitterStrategy = require('passport-twitter').Strategy; let session = require('express-session');

AWS.config.loadFromPath('src/server/c.json'); let s3 = new AWS.S3();

let app = express();

app.use(compression()) app.use(bodyParser.json({limit:"15mb"})); app.use(express.static('public')); app.use(cookieParser('keyboardcat'));

app.use(session({ secret: 'keyboardcat', resave: true, saveUninitialized: true,

})); app.use(passport.initialize());

app.use(passport.session());

...... ///Api .......

const PORT = 8000;

const server = app.listen(PORT,() => { console.log('Express Server Running') });

const horizon_options = { project_name: 'image', permissions: false,

auth: {
    token_secret:  'jJ99999999911111111222222222222^%!',
    allow_anonymous: true,
    allow_unauthenticated: true,

}

};

const horizon_server = horizon(server, horizon_options);