403 Forbidden error when using port in URL
Posted by: devPhp@CT (199.15.238.---)
Date: May 04, 2024 03:40PM

Hi All smiling smiley

I need to use the port number (port 80) in my localhost URLs, but I get a 403 Forbidden error when I do.

For example if I open [localhost] it loads and opens in the browser fine

If I use the 80 port number [localhost] the browser reports 403 Forbidden.

I've checked and WAMP Apache is running on port 80.

Any ideas

Thanks smiling smiley

Options: ReplyQuote
Re: 403 Forbidden error when using port in URL
Posted by: Otomatic (Moderator)
Date: May 04, 2024 04:23PM

Hi,

Port 80 is the default port for the http protocol, so there's absolutely no need to specify the port number in the url!

And if you need to specify a port other than 80, don't do so at the end, but just after the domain name: 'http://localhost:8080/example-site/

If, in Wampserver, you want to use ports other than 80, you must create these additional ports by Right-Click -> Tools -> Add a Listen port to Apache

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: 403 Forbidden error when using port in URL
Posted by: devPhp@CT (199.15.238.---)
Date: May 04, 2024 04:52PM

Thanks for your reply smiling smiley

But the app/plugin I use to open a PHP file in the browser appends the port number. So I know I don't need the port number, but it's being forced!

Is there a way to allow this type of URL: [localhost]

Thanks

Options: ReplyQuote
Re: 403 Forbidden error when using port in URL
Posted by: Otomatic (Moderator)
Date: May 04, 2024 07:35PM

You'll have to ask the app/plugin creator/distributor, perhaps there's a parameter to modify so that the port number isn't added.

> Is there a way to allow this type of URL: 'http://localhost:8080/example-site'

Yes, but you need to tell Apache to listen on port 8080, so as mentioned above :
If, in Wampserver, you want to use ports other than 80, you must create these additional ports by Right-Click -> Tools -> Add a Listen port to Apache.

Your local sites must be defined as VirtualHost, where you can set a specific port for this VirtualHost and the call will then be: 'http://example-site:8080/'.

See : The need for Virtual Host
and : Wampserver 3 - Create or add a VirtualHost

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: 403 Forbidden error when using port in URL
Posted by: devPhp@CT (199.15.238.---)
Date: May 04, 2024 07:53PM

Thanks again smiling smiley

There is little to no chance of the plugin devs changing this.

I tried using port 8080 but I get the same error?

Thanks smiling smiley

Options: ReplyQuote
Re: 403 Forbidden error when using port in URL
Posted by: devPhp@CT (199.15.238.---)
Date: May 05, 2024 12:27AM

Hi, just so you know I've used a different plugin that does not append the port to the URL!

Thanks for your help smiling smiley

Options: ReplyQuote


Sorry, only registered users may post in this forum.