LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Closed Thread
  Search this Thread
Old 08-13-2020, 04:47 PM   #1
Fred27377
Member
 
Registered: Jun 2020
Posts: 68

Rep: Reputation: Disabled
Perl or bash script to redirect traffic to another site.


This would be great. I know somebody works with these scripts and uses them all the time. My problem is I don’t.

Thank you for reading!
 
Old 08-13-2020, 06:06 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,605

Rep: Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960
Quote:
Originally Posted by Fred27377 View Post
This would be great. I know somebody works with these scripts and uses them all the time. My problem is I don’t.

Thank you for reading!
You need to read the "Question Guidelines" link in my posting signature. Yes, there are MANY people who work with Perl and can write scripts. However, if you want one written FOR YOU, then you need to hire someone and pay them to do it. Otherwise, YOU need to show some efforts of your own. We are happy to help, but we aren't going to do your work for you.

Past that, you provide no details; version/distro of Linux, web server you're using, environment, and what your actual goal is. We can't guess.
 
1 members found this post helpful.
Old 08-13-2020, 07:03 PM   #3
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
Here is an answer, but since your question is remarkably vague, I can't tell whether it fits your case: https://www.linux.com/topic/networki...raffic-part-2/

This is how I found this answer: https://www.google.co.jp/search?q=ba...direct+traffic
 
3 members found this post helpful.
Old 08-14-2020, 06:19 AM   #4
Fred27377
Member
 
Registered: Jun 2020
Posts: 68

Original Poster
Rep: Reputation: Disabled
TBOne - I hired a programmer from Fiverr. You know the site. He couldn’t do it. I’m looking for url forwarding example. I am not near the Perl scripting phase yet. I want to figure out how some one does it first. Facebook does it and bitly. Is this just a million CNAMES or is there as I suspect much more to it? I know you Can forward names with Apache. I’ve done that. So that’s two ways CNAMES and Apache. There’s also html.
 
Old 08-14-2020, 07:51 AM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,288
Blog Entries: 3

Rep: Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718
Please describe your task again, what you want to actually accomplish -- not how but what.

What kind of traffic do you wish to redirect TCP, UDP, etc? Or are you looking above the networking layer at the application layer, HTTPS, SSH, SIP, RTSP, etc?
 
Old 08-14-2020, 08:13 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,605

Rep: Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960
Quote:
Originally Posted by Fred27377 View Post
TBOne - I hired a programmer from Fiverr. You know the site. He couldn’t do it.
Shocked I am not.
Quote:
I’m looking for url forwarding example. I am not near the Perl scripting phase yet. I want to figure out how some one does it first. Facebook does it and bitly. Is this just a million CNAMES or is there as I suspect much more to it? I know you Can forward names with Apache. I’ve done that. So that’s two ways CNAMES and Apache. There’s also html.
Again, as asked several times now; WHAT ARE YOU TRYING TO ACCOMPLISH??? You have STILL provided no details about your system, or why exactly you can't do what you need through Apache or html, as you say you already know. Again, you need to do basic research and show your own efforts...putting "perl script url forwarding" into Google pulls up a LOT, including many examples and sample code. Not sure what more you need.

AGAIN: unless you provide details and answer questions, there is nothing we can do to help you.
 
1 members found this post helpful.
Old 08-14-2020, 08:25 AM   #7
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,591

Rep: Reputation: 2542Reputation: 2542Reputation: 2542Reputation: 2542Reputation: 2542Reputation: 2542Reputation: 2542Reputation: 2542Reputation: 2542Reputation: 2542Reputation: 2542

There are numerous different ways to redirect traffic that vary from a single-line of code/config to installing dedicated switch/firewall appliances with fancy management interfaces.

You almost certainly don't need the latter, but it's not possible to say whether your issue can be solved with a single line because you've still not described what your actual issue is.

* Do you want all traffic from domain1 sent to domain2 or only some of it?
* Does the user need to know they're going to domain2 or does it not matter?
* Are both sites hosted on the same server or different servers?
* What (if any) server software is installed on the machine hosting domain1?
* What level of access/control do you have to that server?
etc

Changing DNS might be an option, but depends on domain2's servers accepting the request for domain1 - a CNAME is just an alias; it doesn't actually redirect - and of course you need control of the DNS records, and there's the propagation delay (can be 20 minutes, can be 48 hours).

Apache has at least four different ways of doing it, depending on the specific needs involved.

A HTML meta refresh is a low skill / low effort solution that may well be perfectly good enough for your needs, but you need to say precisely what those are.

If the website is written in Perl or Bash then they could generate the meta tag, or a HTTP 3xx response, or even act as a reverse proxy - but only if there are conditions involved (e.g. database lookup) that can't be addressed by the front-end server (i.e. Apache), because there's no need to re-write functionality that already exists and is well tested.

 
Old 08-14-2020, 08:54 AM   #8
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by Fred27377 View Post
This would be great. I know somebody works with these scripts and uses them all the time. My problem is I don’t.

Thank you for reading!
If you have Apache web server, then you can also do something like this:
https://httpd.apache.org/docs/2.4/re...remapping.html
 
1 members found this post helpful.
Old 08-14-2020, 12:09 PM   #9
Fred27377
Member
 
Registered: Jun 2020
Posts: 68

Original Poster
Rep: Reputation: Disabled
Thank you for the Apache site. I use some of this in my site already. The challenge is to create 1000 sub domains that all resolve. This would be like BITLY.com or Facebook. I’m sure these sites are also registrars. I just have to put my toe in the water if you get what I mean?
 
Old 08-14-2020, 12:42 PM   #10
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,605

Rep: Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960
Quote:
Originally Posted by Fred27377 View Post
Thank you for the Apache site. I use some of this in my site already. The challenge is to create 1000 sub domains that all resolve. This would be like BITLY.com or Facebook. I’m sure these sites are also registrars. I just have to put my toe in the water if you get what I mean?
Nope, still don't. And if you're trying to run a large-scale site and you're wanting to do redirects like that, good luck.
Quote:
Originally Posted by Fred27377
If you need to host a site on virtual server. Hit me up no cost and have fun.
If you have no idea how to do a redirect or write a script, why on earth would I want to host a server with you? You've still not answered ANY questions we've asked about your issue, so I'm presuming that communications with you regarding a hosted server would be in a similar vein.

If you're not going to answer questions that are asked of you, why bother posting a question??? You've STILL not provided any details, despite being asked numerous times thus far.
 
1 members found this post helpful.
Old 08-14-2020, 02:47 PM   #11
Fred27377
Member
 
Registered: Jun 2020
Posts: 68

Original Poster
Rep: Reputation: Disabled
Thank you for caring! How about this. Create a Perl script with a 1000 numbers generated 1 through 1000. Append the host with these numbers in a file. Use Perl cgi to add these to a perlcgi webpage. Generate a 1000 HTML pages with a file label in sequence.

This would work because you could use 1000 of the same page of HTML.

Better?
 
Old 08-14-2020, 02:57 PM   #12
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,605

Rep: Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960
Quote:
Originally Posted by Fred27377 View Post
Thank you for caring! How about this. Create a Perl script with a 1000 numbers generated 1 through 1000. Append the host with these numbers in a file. Use Perl cgi to add these to a perlcgi webpage. Generate a 1000 HTML pages with a file label in sequence.

This would work because you could use 1000 of the same page of HTML. Better?
Nope...mainly because you still haven't shown any effort of your own, at all.

AGAIN, we are NOT going to write your scripts for you, period. You have been given direction and hints. You **STILL** do not answer questions asked or provide any details. You have been told this before:
https://www.linuxquestions.org/quest...es-4175676771/

Asking for handouts won't get you far.
 
Old 08-14-2020, 03:15 PM   #13
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,217

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
Quote:
Originally Posted by Fred27377 View Post
I’m looking for url forwarding example. I am not near the Perl scripting phase yet. I want to figure out how some one does it first. Facebook does it and bitly.
I have no idea what you're trying to set up, but if you just want to know how to write something like bit.ly, well, this was my first hit:

How to write a reverse-proxy with Go in 25 minutes

This is something the Fiverrr guy should have been able to give you. Unless he was dealing with a common cause of project failure. Which is unclear requirements.

Maybe give us a simplified example where you show us two subdomains and a URL, and tell us how how want the redirection to work?

Last edited by dugan; 08-14-2020 at 04:35 PM.
 
1 members found this post helpful.
Old 08-14-2020, 04:35 PM   #14
Fred27377
Member
 
Registered: Jun 2020
Posts: 68

Original Poster
Rep: Reputation: Disabled
Alright thank you Dugan. Let’s go again. Maybe the reverse proxy is a better idea. You get a request and generate a blank webpage. You would have to assign page name url and HTML or xml. I liked the GO video. Seemed possible and on demand. I will look for examples. Thank you.
 
Old 08-15-2020, 05:45 AM   #15
Fred27377
Member
 
Registered: Jun 2020
Posts: 68

Original Poster
Rep: Reputation: Disabled
Perl pseudo code :

While loop
Sed >> list1
Next

While
List1 > touch > final dir

It’s possible in under a page!
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
redirect non www site to www site with 301 status mitter1989 Linux - Server 1 08-02-2014 07:53 AM
How to capture web site incoming traffic and redirect to different IP/server superkikim Linux - Server 5 11-08-2012 11:04 AM
call perl script through another perl script with arguments nanda22 Linux - Newbie 21 07-21-2009 12:18 AM
[HELP] redirect traffic to spesific port based on Traffic Content using iptables summersgone Linux - Server 2 06-22-2009 11:26 AM
Including methods from a perl script into another perl script gene_gEnie Programming 3 01-31-2002 05:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:44 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