Report this

What is the reason for this report?

how to hide port when viewing page from page source ( https://mydomain.com:443)

Posted on October 29, 2016

Hello, can anyone help me to hide the port and showing domain only when viewing site from page source ? port only visible if you see it from the page source. screenshot: http://image.prntscr.com/image/59e47f990fa547af9709e9f2a1272834.png

My nginx conf :

code
server {

	listen 443;
	server_name domain.me www.domain.me;

	root /home/kyo/webroot;
	index index.php;

	# SSL
	ssl on;
	ssl_certificate /etc/ssl/cert_chain.crt;
	ssl_certificate_key /etc/ssl/private/domain.me.key;
	
	ssl_session_timeout 5m;
    	ssl_session_cache shared:SSL:50m;

	port_in_redirect off;

	# intermediate configuration.
    	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    	ssl_prefer_server_ciphers on;
    	ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

    	# Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
    	ssl_dhparam /etc/ssl/certs/dhparam.pem;

	location / {
	 rewrite /sitemap.xml$ /sitemap.php last;
	 rewrite /feed$ /rss.php last;
	 rewrite ^/go/(.*)$ /go.php?id=$1 last;
	 rewrite ^/view/(.*)$ /page.php?id=$1 last;
	if (!-d $request_filename){
	 set $rule_4 1$rule_4;
	}
	if (!-f $request_filename){
	 set $rule_4 2$rule_4;
	}
	if ($rule_4 = "21"){
	 rewrite ^/mp3/(.*)(\/|\.)(.*)$ /search.php?q=$1&slug=$2 last;
	}
	if (!-d $request_filename){
	 set $rule_5 1$rule_5;
	}
	if (!-f $request_filename){
	 set $rule_5 2$rule_5;
	}
	if ($rule_5 = "21"){
	 rewrite ^/(.*)$ /download.php?po=$1 last;
	}
}

	location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
	#Expire Header
	location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
    	expires 1d;
    	add_header Pragma public;
    	add_header Cache-Control "public";
}

	#error_page 404 /404.html;

	# redirect server error pages to the static page /50x.html
	#
	#error_page 500 502 503 504 /50x.html;
	#location = /50x.html {
	#	root /usr/share/nginx/html;
	#}

	# y access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	
	location ~ /\.ht {
		deny all;
	}
}



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Are you sure it isn’t written in source code like that?

As you said, it’s working flawless when used from browser, you can only see it in source code.

Depending on solution, you probably need to remove it manually. But care, if you use some CMS solution, make sure you didn’t write somewhere URL with that :443. For example, if you use WordPress, make sure you didn’t type WordPress and Site URL with :443 at the end. This setting can be found under Settings, General.

If this is not the case, check manually. SSH to your server and execute this:

  1. grep -rn "https://mydomain.me:443" /home/kyo/webroot

(Make sure you change mydomain.me with your real one :) ) If there is files with :443 domain, it should show you which ones have that. Go one by one, remove it from URL and you should be good to go.

This is not a big problem, :443 is anyways default, so everyone already knows that. :)

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.