Jump to content

Any idea? https://url.com -> http://localhost:port


horstepipe

Recommended Posts

horstepipe

Hey

In a Linux environment, are there any options to tell the OS to redirect a specific https address, e.g.

https://example.com

to localhost + custom port, like

http://localhost:8080

?

The hosts file doesn't help, as the application is running only on plain http.

Any ideas welcome.

Best regards

 

edit: ah just to make sure, I'm talking about "outgoing" connections, so kind of proxying, no incoming connections (no reverse proxy). So basically I want to prevent the request running through the internet.

Edited by horstepipe
Link to comment
Share on other sites

mastrmind11
55 minutes ago, horstepipe said:

Hey

In a Linux environment, are there any options to tell the OS to redirect a specific https address, e.g.


https://example.com

to localhost + custom port, like


http://localhost:8080

?

The hosts file doesn't help, as the application is running only on plain http.

Any ideas welcome.

Best regards

 

edit: ah just to make sure, I'm talking about "outgoing" connections, so kind of proxying, no incoming connections (no reverse proxy). So basically I want to prevent the request running through the internet.

Assuming you mean outbound traffic from a single machine, then I believe you can do this with iptables (though I am by no means an expert on this).  If you mean all outbound traffic from your LAN to that domain , then no, you'd have to do something at the edge of your network (rpi, router, or some other appliance cpable of redirects)

Link to comment
Share on other sites

horstepipe
9 minutes ago, mastrmind11 said:

Assuming you mean outbound traffic from a single machine

yes that's what I'm trying to accomplish.
I'll take a look at it, thanks!
If you have a nice guide, I'd be grateful for a link 🙂

Link to comment
Share on other sites

mastrmind11
9 minutes ago, horstepipe said:

yes that's what I'm trying to accomplish.
I'll take a look at it, thanks!
If you have a nice guide, I'd be grateful for a link 🙂

since you're going for a domain redirect, not sure iptables can do it out of the box.  check here https://unix.stackexchange.com/questions/557388/firewall-rules-based-on-domain-name-instead-of-ip-address

heres how you'd do it with just ip https://unix.stackexchange.com/questions/323791/how-can-i-redirect-outbound-traffic-to-another-ip-using-iptables

as mentioned in a comment on the above, this tool will do it natively https://www.configserver.com/cp/csf.html

Link to comment
Share on other sites

Hi,

What exactly are you trying to do?  There might be a better method if we know what you're trying to accomplish.

Carlo

Link to comment
Share on other sites

pwhodges

You could run up a simple reverse proxy forwarding a new domain "myredirectdomain" to "externaldomain:8080".  Using Caddy you can set that up in a single line.  You'd need the domain (which can be got free, I think), or just define it in your hosts file if you're only doing it on one machine (or a very few).

Paul

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...