How to hide my website port number? - url

I've been able to map www.xyz.com sub domain name to some ip port where port is not the default http port 80 but e.g. 1234
Entering www.xyz.com in browser works but resolves to www.xyz.com:1234
Please bear with me if my question sounds silly as am no expert of the networking domain.
Is that possible to keep port to non-default without it appearing with sub domain name in browser address bar?

Browser will show non-standard ports. However there are some workarounds depending on your tech stack:
You can have a redirect from port 80 (or 443) to port 1234.
For example in AWS you can have a Load Balancer that redirects traffic
from port 80 to 1234. The user in his browser will see no port.
You can have a Reverse Proxy with a rewrite rule.
Check here:
Rewrite rule to hide port from URL of Rails server?

No, this is not possible. Browsers always show non-default port numbers.

No, it's not possible to hide "1234" port number from your url.
Because:
For "http" url, browser only hides "80" port number.
For "https" url, browser only hides "443" port number.

Related

Remove port 8080 from URL on IIS 10

I have an IPFS services running on port 8080 and can currently access it when I include port 8080 in the url:
http://www.mywebsite.com:8080/ipfs/{IpfsHash}
I also have 2 rules that deal with redirecting non http requests to https and another one redirecting non-www to www. How can I add another rule that will redirect request above to
https://www.mywebsite.com/ipfs/{IpfsHash}
Any help is appreciated. Thanks

nginx + docker: http to https redirection

I have an nginx inside a docker container which I want to force SSL on all request. Because I need to expose the webserver port in a different port outside the container, I'm not using standar ports when accesing the server.
I mapped the SSL port 443 inside my container to 8888 outside, so when I write the URL https://myserver:8888 the HTTPS works fine.
What happens when I don't use the https prefix? The port 443 is still listening but since I'm not using https schema I get the following error:
400 Bad Request
The plain HTTP request was sent to HTTPS port
If I redirect request to port 80 to 443 it is not enough, since because I'm accesign by the port 8888 the all requests are incoming by port 443, but I can not guarantee the schema used is HTTP.
I mean, the following block has not effect because I'm not exposing port 80 outside, only 8888 which maps direcly to 443
server {
server_name myserver;
listen 80;
return 301 https://$host:$server_port$request_uri;
}
How can I force it to work even when the user puts http on the URL?
Thank you
You have to use two different ports : for example 8888 and 8889.
Bind the first port to the container's 80, and the second to 443.
If a client want to contact your container on http it will have to use 8888 (-> 80). If the vhost is well configured nginx will serve a 301 or 302 HTTP return code (a redirect) to the https port (8889 -> 443).
So your return might look like
return 301 https://$host:8889$request_uri;
And the client will start a TLS connection on the right port.
Due to technical limitation it's pretty hard to use the same port for both clear traffic and TLS-encrypted one, so most of the webservers will listen on two distinct ports : 80 for plain-text and 443 for TLS.

Ubuntu server - port forwarding

I need to redirect http port 80 to port with specific page, which running on port 9090/somepage.
So in short:
Need redirect x.x.x.x:80 -> x.x.x.x:9090/page
I tried to do by command iptable, but I not be able to redirect port to specific port and page (only port to another port).
Please how I can realize this?
You probably need an proxypass in the virtualhost to redirect it. For Apache:
https://httpd.apache.org/docs/current/mod/mod_proxy.html

How to remove the :port number from the end of an IIS URL?

In IIS, I noticed when you use the default ports (80 for http and 443 for https) the port number doesn't display at the end of the URL in your browser. However, if you use a different port it will display.
Example:
Default port generates link: http://www.example.com
Custom port generates link: http://www.example.com:8301
Is there a setting you can change to make the port (in this case, :8301) not display without using the defaults?
80 is a default port for HTTP connections.
http://example.com = http://example.com:80
443 is a default port for HTTPS connections.
https://example.com = https://example.com:443
If you are hosting on an other port, you have to include it in the URL.
It's not a IIS rule - it's about HTTP in general. You cannot configure the server in such way that http://example.com will work with port 8301 and I can't imagine any situation when it can be useful. I strongly believe that 80 port is chosen by default on a browser-side but not assigned on a server-side.
If you want users to reach this website by http://example.com URL and it must be a main page then swap your 8301 and 80 ports WebSites' bindings.

Ruby Rails callback URL in development

I am integrating Plivo in to my application(Ruby/Rails) and I would like to setup the router to point to my local dev environment for the callback. I have setup my controller method: plivo/receive_sms and the associated route in routes.rb
My question is: How do I setup my router(NETGEAR) to receive the callback for localhost:3000/plivo/receive_sms from Plivo?
I have tried forwarding port 80 to my local IP (192.168.1.20) But that did not work.. So I added ports 3000 - 8080 with no success.
That should work:
Make sure you are forwarding external port 80 to your local port 3000.
Make sure the Plivo is configured with your OUTGOING public IP address as the call back URL hostname. (google for "What is my ip"? and google will tell you)
If that doesn't work, perhaps your computer is firewalled? Or your router / ISP firewalls port 80?
If #3 is the case, then try forwarding port 3000 to your local port 3000, but then you have to be able to change the callback URL (#2) to use port 3000.
Or - try:
localtunnel.me
localtunnel gem
PageKite
ShowOff
https://pagekite.net/2011-04-20/PageKite_meets_Showoff
http://devblog.avdi.org/2012/04/27/http-forwarding-services-for-local-facebook-development/
Or if you have access to a server thats sits somewhere on the internet, there are gems similar to local tunnel that will use your own server to do the proxying.
Or you can do it manually with SSH using the -R or -L option (I forget which).

Resources