OpenSource Hardware, Back-End, CTF

Article List

Tag Cloud

tag1 tag2 tag3 tag4

About

关于关于关于关于关于关于关于

查看更多

Feeds

RSS feed
Python Bottle
01 August 2017

使用Ajax时的跨域请求问题

from bottle import route, run, template, response
@route('/')
def index():
    response.headers['Access-Control-Allow-Origin'] = '*'
    response.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, OPTIONS'
    response.headers['Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token'
    return ret_str