Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am having trouble finding a way to hyperlink to https://secure.mysite.net:443

I tried: <a href="https://secure.mysite.net:443/">HTTPS SSL</a>

However it simply takes me to https://secure.mysite.net (port 80)

Is there a way to hyperlink ports using PHP, Javascript or HTML?

I've searched almost everywhere for an answer :(

share|improve this question

migrated from stackoverflow.com Dec 1 '11 at 0:38

This question came from our site for professional and enthusiast programmers.

    
Downvoters and closevoters: Look at the comments in my answer - there seems to be a real issue here –  Pekka 웃 Nov 24 '11 at 17:48

2 Answers 2

up vote 2 down vote accepted

However it simply takes me to https://secure.mysite.net (port 80)

Probably not: 443 is the default port for https, so it's not necessary to specify it explicitly, and some browsers will even remove it from the URL (A quick check reveals that at least Chrome does - the others probably do, too.)

If you were on port 80 using https, you'd see :80 added to the URL.

There probably is no problem.

share|improve this answer
    
:( I could change the port of the site? But it needs to be https –  King Nov 24 '11 at 17:37
    
@King you probably already are on https. How do you know you are on port 80? –  Pekka 웃 Nov 24 '11 at 17:38
    
Because the page dosen't load. However it does when I add :443 –  King Nov 24 '11 at 17:42
    
@King that's really weird. I guess you'd have to find out which port the requests go to. What browser are you trying this in? Have you tried with different browsers? –  Pekka 웃 Nov 24 '11 at 17:48
    
FireFox, whatever the latest version is –  King Nov 24 '11 at 17:48

IE, Chrome and Firefox, behave in pretty much the same way when it comes to parsing URI's.

If you specify href="https://secure.site.com:443" most browsers will parse this into the DOM as https://secure.site.com". The 443 part is stripped because it is redundant and because the default port for https is already and always 443.

If you do a view-source you get to see what was sent to the browser, the https://secure.site.com:443 will remain unmolested, however if you inspect the DOM this is parsed from:

https://secure.site.com:443

To:

https://secure.site.com

However if you specify an port other than 443 combined with https, for example:

https://secure.site.com:409

Then the port will remain intact and will stay as part of the URL in the live DOM.

You can't specify http://secure.site.com:443, well you can but it won't work if it's an SSL/TLS endpoint. This is for a couple of reasons.

  1. https signals to the browser that it should engage SSL/TLS and encrypt the request before sending to the server. Specifying https is the only way to make that happen.

  2. It's perfectly legal to specify http://secure.site.com:443 or any other port for that matter. However if you're expecting to connect using TLS/SSL by specifying http://secure.site.com:443 instead of https://secure.site.com:443, then nothing will happen. The port alone does not turn on SSL/TLS and when the server receives the request it'll just bail out, you need to specify https to tell the browser that it needs to use SSL/TLS.

If your server is configured according to normal conventions, i.e. the server listens on port 80 for unsecured traffic and listens on port 443 for SSL/TLS traffic then there is absolutely no need to specify both https and port 443 in your URL's. The browser already knows that https means "use port 443" (unless you specified something non-standard, such as 10443, in which case it'll keep that port number as part of the url in the DOM).

When you say:

I tried: <a href="https://secure.mysite.net:443/">HTTPS SSL</a>
However it simply takes me to https://secure.mysite.net (port 80)

Yes, it'll take you to https://secure.mysite.net, however that's not port 80, it's port 443, https means port 443.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.