Celeb Glow
general | March 17, 2026

How to return status 301 on port 80 without webserver

Is there any way to implement HTTP redirect on port 80 if there's no web servers installed?

I want to protect my server from random access and redirect whoever hits port 80 or 443 there to the main websites. Right now it is setup to drop connection attempts on both ports.

I know, I could've created simple app that will listen port 80 and return http header with 301 status, but I'm curious if that's can be done kinda native?

1

1 Answer

You can use netcat as a very simple web server:

yes | xargs -i printf 'HTTP/1.0 301 Moved Permanently\nLocation: | sudo nc -k -l 80
5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy