React js using create-app how to set X-FRAME-OPTIONS on webpack

夙愿已清 提交于 2019-12-06 01:58:51

X-Frame-Options is a HTTP header and setting it depends on the application you use as HTTP server, not on the files being served. In this case, if you want to set a header for webpack-dev-server, you can do it like this (setting in webpack.config.js):

devServer: {
    ...
    headers: {
        'X-Frame-Options': 'sameorigin'
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!