LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-26-2020, 02:19 AM   #1
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Rep: Reputation: Disabled
Post Firewalld and HTTP protocol.


Hello,
I want to know, is it possible to use Firewalld for forward a HTTP request to something else? For example, when a user enter something in its browser then his\her request forward to another place.

Thank you.
 
Old 09-26-2020, 09:04 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
See for example https://access.redhat.com/documentat...ort_forwarding (TLDR: Yes).
 
1 members found this post helpful.
Old 09-26-2020, 10:36 AM   #3
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
Thank you for the link, but I can't see any HTTP protocol!!!
I want to forward the request in the browser. For example, when a user enter 1.2.3.4 in browser then the request forward to "http://www.example.net".
 
Old 09-26-2020, 10:54 AM   #4
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Hi,


Quote:
Originally Posted by n00b_noob View Post
Thank you for the link, but I can't see any HTTP protocol!!!
.
So, at lest you saw the 80!
That is exactly the port number for HTTP protocol.
 
Old 09-26-2020, 11:18 AM   #5
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by n00b_noob View Post
Thank you for the link, but I can't see any HTTP protocol!!!
I want to forward the request in the browser. For example, when a user enter 1.2.3.4 in browser then the request forward to "http://www.example.net".
Then, on server 1.2.3.4, you need to forward TCP ports 80 and 443 (for HTTPS) as described under "To redirect a port to another port at a different IP address".
 
Old 09-26-2020, 12:51 PM   #6
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Could Firewalld support requests that made by Browsers? A user enter 1.2.3.4 IP address in his\her Browser and the website that open is "https://example.net".
 
Old 09-26-2020, 03:16 PM   #7
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by n00b_noob View Post
Could Firewalld support requests that made by Browsers? A user enter 1.2.3.4 IP address in his\her Browser and the website that open is "https://example.net".
That's typically handled by the web server. A call to a web server by IP will return the first VirtualDomain defined (using apache).
 
Old 09-26-2020, 06:59 PM   #8
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by n00b_noob View Post
Could Firewalld support requests that made by Browsers? A user enter 1.2.3.4 IP address in his\her Browser and the website that open is "https://example.net".
Firewalld's port forwarding supports traffic for a certain port. It is unable to determine whether the request is from a browser or a different piece of software.
 
Old 09-27-2020, 01:01 AM   #9
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
That's typically handled by the web server. A call to a web server by IP will return the first VirtualDomain defined (using apache).
I wanted to do it without Apache!
 
Old 09-27-2020, 01:05 AM   #10
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
Firewalld's port forwarding supports traffic for a certain port. It is unable to determine whether the request is from a browser or a different piece of software.
Thus, forwarding will work in any conditions? Whether from the browser or something else?
 
Old 09-27-2020, 02:25 AM   #11
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by n00b_noob View Post
Thus, forwarding will work in any conditions? Whether from the browser or something else?
Yes.
 
Old 09-27-2020, 03:01 AM   #12
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Thank you.
Can I use domain name instead of IP?
Code:
# firewall-cmd --list-forward-ports port=80:proto=tcp:toport=443:toaddr=
 
Old 09-27-2020, 04:28 AM   #13
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by n00b_noob View Post
Thank you.
Can I use domain name instead of IP?
I had a quick look at the manual page but could not find an answer. Why don't you just try?
Quote:
Code:
# firewall-cmd --list-forward-ports port=80:proto=tcp:toport=443:toaddr=
You will need the --add-forward-port option, not --list-forward-ports.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Forward internal/outbound HTTP(s) traffic to Proxy (firewalld) dragon2309 Linux - Networking 1 04-10-2017 03:19 PM
LXer: Tutorial: Border Gateway Protocol, The Routing Protocol of the Internet LXer Syndicated Linux News 0 11-13-2008 05:11 AM
Where to turn SSHv1 protocol and SSHv2 protocol on and off Minnie Nguyen Linux - Enterprise 3 07-05-2006 02:12 PM
"socks5" -> "http" proxy protocol, or ssh tunnel to sock5 ? I'm beyond http p vmicho Linux - Networking 2 12-16-2003 05:32 AM
Unsupported protocol 'Compression Control Protocol' (0x80fd) received RKris Linux - Software 0 08-21-2002 08:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration