Link to home
Start Free TrialLog in
Avatar of secret_boy
secret_boy

asked on

Hiding my port(8080) from user

Dear Experts,

My Internet Service Provider(ISP) has blocked the port 80, and I have registered a domain, say abcabc.com.
It works fine for my server setting.

when user type www.abcabc.com, I set it redirect to abcabc.com:8080

In the "Domain Name Maintenance" of my Domain Name Provider:
************************************************************
Record Type
--------------------------------------------------------------------------------------
A/CNAME(Alias)/MXE/MX/URL Redirect/URL Frame
************************************************************

I currently set to
************************************************************
Hostname      Address                  Record Type
--------------------------------------------------------------------------------------
www            abcabc.com:8080            URL Redirect
*            xxx.no-ip.com            CNAME(Alias)
************************************************************

When I type www.abcabc.com, it will redirect to xxx.no-ip.com:8080 which is my machine.

I have a server, running apache2 using 8080; when I list out a directory from a browser, all the hyper links there would be displayed as:
/test.html       -> http://abcabc.com:8080/test.html
/abc.html      -> http://abcabc.com:8080/abc.html

is it possible to set something to make the hyper links in apache
/test.html       -> http://www.abcabc.com/test.html
/abc.html      -> http://www.abcabc.com/abc.html

I think there is something to set in the Virtual Host in apache and in my domain name provider, as I remember I has made it works "accidently".
Thanks for your help!

Avatar of secret_boy
secret_boy

ASKER

In addition,

I have set my apache start using user "apache" instead of "root" with port 8089.
My router will route all traffic from 8080 to 8089 of my machine.

Pls tell me if u want more information.
Thanks in advance!
I guest setting "UseCanonicalName On" in httpd.conf may work, but tried..................
no luck.

No because the outside world has to direct which port to use since port 80 is blocked by your ISP and your using port 8080.  To get the system's to recongize this http://www.abcabc.com/test.html port 80 has to be enabled but as you stated before its blocked by the ISP.  What you can do is "Cloak" your domain name so the user only see's www.abcabc.com in the address bar at all times even when directed to another page.

So the main issue here is with this url "http://www.abcabc.com/test.html" the client is going to try to access the web server on port 80.  But unfortunetly port 80 is blocked so the session will hang.  

The url has to be directed like this http://www.abcabc.com:8080/test.html to tell the client to use port 8080 to access the web server on port 8080.
Thanks Stanley,
yes, I know what u mean.

but if I type http://www.abcabc.com/test.html manually in the browser, it can be redirected to http://abcabc.com:8080/test.html.

All I want to do is to display the link as I said.
I do think that there is just some setting tricks in Apache like "UseCanonicalName On"

It is not possible, because the standard HTTP port is 80, and your server is using a non-standard port, so the URL will contain the port information.

A workaround is to get a webserver outsite your ISP to host for the domain name www.abcabc.com, and redirect the page to your webserver. You can use frames to hide the URL.

Yes, that's network level problem. And I don't like the "URL Frame" method as it does nothing on my apache file listing.

Let me explain more explicitly what I want:
all pages requesting www.abcabc.com/test.html is redirected to http://abcabc.com:8080/test.html

that's unsolvable if I don't ask the ISP to open the port.


But my question here is at the application level: the setting in Apache.
when do the listing in the browseable /share directory,
the links are automatically listed as
"http://abcabc.com:8080/share/test.html"
"http://abcabc.com:8080/share/abc.jpg"
"http://abcabc.com:8080/share/abc.zip"

is there any setting in Apache, to list files in /share as
"http://www.abcabc.com/share/test.html"
"http://www.abcabc.com/share/abc.jpg"
"http://www.abcabc.com/share/abc.zip"

I know all transmission must pass through port 8080, but is there any method to make apache to "generate" www.abcabc.com instead of abcabc.com:8080?

You should be able to just use a mod_rewrite rule

Something like:

RewriteEngine on
RewriteRule   ^/(.*)    http://abcabc.com:8080/$1

(don't quote me that that's exactly right, I haven't had enough coffee yet)

The Apache rewrite guides should help though:
httpd1.3
http://httpd.apache.org/docs/misc/rewriteguide.html

httpd 2.0
http://httpd.apache.org/docs-2.0/misc/rewriteguide.html
If you take out the 8080 the website will NOT be able to be accessed.  Because the client is going to be searching on the wrong port.  What service are you using for your dns and web forwarding?
Thanks christsis.

U get what I mean.
I need to recompile my apache to add this module.

Tell you once when I am able to, thanks.
I have tried.
oh.......document rewrite seems not work for my case.


For example:
If I write a rule:
abcabc.com:8080 rewrite to www.abcabc.com

When I type in the browser.
abcabc.com:8080 -> www.abcabc.com -> abcabc.com:8080 -> www.abcabc.com -> loop many times.................

is there any other method?
Man I wish I had a test box laying around to try stuff before I spout more stuff off... :)

I think this actually requires a combination of mod_proxy and mod_rewrite. I just don't have a box to test it's reaction to make sure I'm giving you a good config... But should it work it'd be something like:

ProxyRequests Off
RewriteEngine On
ProxyPass / http://www.abcabc.com:8080
RewriteRule ^/(.*) http://www.abcabc.com:8080/$1 [P,L]
ProxyPassReverse / http://www.abcabc.com:8080/

it doesn't work for me.............is there any other method?
ASKER CERTIFIED SOLUTION
Avatar of christsis
christsis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:
Accept - christsis

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Bill_Fleury
EE Cleanup Volunteer