package com.ruoyi.common.filter;

import org.springframework.stereotype.Component;

import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Component
public class MyResponseHeaderFilter implements Filter {
    //防止站点劫持
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException {
        HttpServletResponse res = (HttpServletResponse) response;
        res.setHeader("X-Frame-Options", "SAMEORIGIN");
        chain.doFilter(request, response);
    }

}
