S
S
Sveratum2015-02-13 12:15:27
iptables
Sveratum, 2015-02-13 12:15:27

How to redirect from http to https in iptables?

Good afternoon!

I can't set up iptables correctly.
I have a certain resource that is running on port 8443, I need incoming connections to http and https (i.e. 80 and 443) to be redirected to 8443.
Or rather, it’s even easier to redirect to https when trying to access http, but now from https to 8443, while ports 80 and 8443 were closed to outside access.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Daniel, 2015-02-13
@flameflower74

As it is difficult, in my opinion, the task is described. I don't want to read. :)
There is a redirect key in iptables, it works in a NAT table.
For example:
It will redirect traffic coming to interface eth0 with destination port 80 to port 3128.
In other words, a typical traffic redirect to squid.

A
Alex, 2015-02-22
@isqua

It seems to me that it is better to solve this problem at the level of the web server.

S
Sveratum, 2015-02-23
@srsd

In general, I combined a couple of methods: firstly, nat iptables, and secondly, in the application itself, I added a function to process requests from another port. I broke the documentation several times and did not find a documented solution in my own way. So far so good in tests.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question