I’m developing a project which filters traffic in a network. (like internet gateway or firewall).I want to redirect a http connection request (containing certain keywords in hostname like “porn”) to another host by using “http 301 redirect”(only for port:80). Now I can do that by sending back a packet with the following header to the source.
HTTP/1.1 301 Moved Permanently
Location: http://www.example.org/
Content-Type: text/html
Please tell me how to do this. Should i modify the packet and send it back to the source? If I do this what are the necessary changes to be made in the packet information (like checksum, dest_ip, source_ip, etc.).
Or Can I make a new packet and send it back to the source?