Skip to content

Commit

Permalink
Cross-Origin Read Blocking
Browse files Browse the repository at this point in the history
CORB
  • Loading branch information
wangzhao committed Aug 2, 2018
1 parent f6d7d62 commit 6dd5e53
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 10 deletions.
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"babel-eslint": "^8.2.1",
"body-parser": "^1.18.3",
"cheerio": "^1.0.0-rc.2",
"cors": "^2.8.4",
"cross-env": "^5.2.0",
"eslint": "^4.15.0",
"eslint-friendly-formatter": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions public/store/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Vuex from 'vuex';
import axios from 'axios';
// axios.defaults.baseURL = 'https://nuxt-auth-routes.glitch.me';
axios.defaults.baseURL = 'https://nuxt-auth-routes.glitch.me';
const store = () => {
return new Vuex.Store({
state: {
Expand All @@ -24,7 +24,7 @@ const store = () => {
},
actions: {
async login({ commit }, { username, password }) {
const { data } = await axios.get('/api/login', { params: { username, password } });
const { data } = await axios.post('/api/login', { username, password });
console.log(data);
commit('SET_USER', data);
}
Expand Down
33 changes: 25 additions & 8 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,30 @@
// // nuxt.showOpen();
// // })

const express = require('express')
const request = require('request')
const app = express()
// const express = require('express')
// const request = require('request')
// const app = express()

app.use('/', function (req, res) {
const url = 'https://nuxt-auth-routes.glitch.me' + req.url
req.pipe(request(url)).pipe(res.set('Access-Control-Allow-Origin', '*'))
});
// app.use('/', function (req, res) {
// const url = 'https://nuxt-auth-routes.glitch.me' + req.url
// req.pipe(request(url)).pipe(res.set('Access-Control-Allow-Origin', '*'))
// });

app.listen(process.env.PORT || 3001);
// app.listen(process.env.PORT || 3001);

// var express = require('express');
// var app = express();

// var cors = require('cors');
// var bodyParser = require('body-parser');

// //enables cors
// app.use(cors({
// 'allowedHeaders': ['sessionId', 'Content-Type'],
// 'exposedHeaders': ['sessionId'],
// 'origin': '*',
// 'methods': 'GET,HEAD,PUT,PATCH,POST,DELETE',
// 'preflightContinue': false
// }));

// require('./router/index')(app);

0 comments on commit 6dd5e53

Please sign in to comment.