Cloud9 adds port 80 to Laravel route

I have two pages, create account and home.

When i go from create account to home. cloud 9 automatically adds 80 and i see ssl connection error.

I see this url in browser

namespace App\Http\Controllers;
use Input;
use Illuminate\Support\Facades\Redirect;
use App\User;
use Hash;
class AccountController extends Controller {
    public function getCreate(){
     return \View::make('account.create');   
    public function postCreate(){
        $validator= \Validator::make(input::all(),
                return Redirect::route('account-create')
                //create account
                $email = Input::get('email');
                $username = Input::get('username');
                $password = Input::get('password');
                //Activation code
                $user = User::create(array(
                        return Redirect::route('home')
                        ->with('global',"sent email");

Hey @ankurreyes12,

Have you seen these docs on ports and IPs:

:books: :snail:

I went through the documentation. But can you tell me in simple words, what should i do to rectify this error? This is just a test project and I am learning php. So, i dont bother much about http or https or whatever port is being used. I just want this error to go away.

1 Like

Hey @ankurreyes12,

To code is to be a detective. Debug, you must :new_moon_with_face: .

I’ve never done PHP in Cloud 9 (or PHP in years) so I can’t simply tell you what to do but I can give you some PHP docs:

Best of luck ! :four_leaf_clover: :smiley:


I also use Laravel and I just run into the same problem. It’s strange as it only does this for a specific route. I never had such problem with Laravel and I think it could be related to the server.

I found the following two steps made it work for me:

  • Update config/app.php to your workspace preview URL. You can get the URL by clicking Share in the top right of the menu bar.
    | Application URL
    | This URL is used by the console to properly generate URLs when using
    | the Artisan command line tool. You should set this to the root of
    | your application so that it is used when running Artisan tasks.

    'url' => '',
  • Pass the host and port to the artisan command when serving preview:
$ php artisan serve --host $IP --port $PORT                                                                                                                                                                                                                      
Laravel development server started on

I got SQLSTATE[HY000] [2002] Connection refused when I try to see the website.

In the testing we did, it looks like this is still an issue that we need to investigate closer but this only happens when the route corresponds to a specific directory exactly.

For example, if I have a directory ~/workspace/laravel/brady and then I try to go to then it’ll redirect me to As a workaround, you can simply rename the route or the directory so they don’t correspond exactly.

@luciendub can you confirm that I have the exact directory and URL situation accurately and then mark this as “solution” for now so others can easily see the workaround for it? We’ll still keep this thread updated when we investigate this and find a permanent and actual solution for it.


In fact, I got in my public fodler a folder “abc” and I also got a route “abc”

And it worked successfully?

Yes, as soon as I deleted the folder! :slightly_smiling:

1 Like

use this withe the ‘=’:
php artisan serve --host=$IP --port=$PORT

1 Like

please solve this my issue it is boring me so well, cloud9 adding :80 port auto in url and geting ERR_SSL_PROTOCOL_ERROR on my browser please take it serious i am to submit my project in 2 days and i doing nothing because of it

This solved the problem for me:

As Lavarel is serving its content from the public directory we need to modify the apache config using nano (a text editor):

sudo nano /etc/apache2/sites-enabled/001-cloud9.conf
Then do the following:

// Change this line
DocumentRoot /home/ubuntu/workspace

// To following
DocumentRoot /home/ubuntu/workspace/public

I’m having the same issue. I have no folders in my public folder, and ANY route that ends with a trailing slash gets redirected to port 80. I tried this with a simple auth, and “” redirects to “” which hits an SSL Protocol Error. I tried another route: “” and the same thing happens - redirecting to “”.

I suspect it’s due to some standard Laravel settings that don’t work well with Apache, but I’m not sure where the error is exactly. Any help would be great.

Ok I think I finally reason for this - essentially this is not a routing error, but an SSL error. If we try accessing using https, then this error won’t occur and the redirect works flawlessly.

Technically, the best solution would be to have automatically redirect to (redirecting to a secure connection and removing the trailing slash), but unfortunately, the error still occurs. Despite that, I’ve found that this solution can address most of the problems.

I’m still searching for the best way to get this, but at least this is “fixed” enough for me to continue with my project. Just putting this up here in case anyone else faces the same issue as me.

I’m late to the party - but I never could find a solid answer, and didn’t have time to research the WTF of it all myself, in order to find a quick fix. But then I did. So here ya go!

Quickest solution I’ve found

sudo nano ~ /etc/apache2/sites-available/001-cloud9.conf

EDIT: I have had hit or miss experiences, where sometimes after running the aforementioned command a blank/empty buffer opens. The first time it happened, I shat my pants because I thought I’d somehow wiped 001-cloud9.conf But just press ctl+X and it’ll switch to the .conf file

Find the FIRST instance of ServerName
Delete the ‘s’ in https://

Ctrl + X  <-- close(you will be prompted to save right about...)
Now you will be prompted to close with/without saving the buffer. Press 'Y'

FINALLY - run sudo service apache2 restart

At this point your redirects will redirect without adding https and :80 to your URL and making you wanna table flip =]

Except caching. (facepalm) – so either clear that crud, or test the update in a “private browsing” tab

1 Like

I am having a similar problem, but I don’t have laravel, just plain php7.2 and renamed hello-world.php to index.php

This problem does not occur when I use php7.1 so my solution, for now is to use php7.1 for my app.

NOTE: i put the space in the urls below because the links are fictitious and block my ability to post.

when I type the url directly: site-name-user-name
I get an error and the url shows redirected to: site-name-user-name

However, i can successfully go to site-name-user-name
but without the port number the url shows with TWO trailing / like this:
When I use the port number I get no trailing /
Sometimes it works when I type https directly rather than typing or letting the default http
I have tried ALL of the suggestions here and a few others from various website suggestions, but nothing seems to resolve the problem.

I know this post is older, but I am experiencing the same issue. Standard route in Laravel, but upon submitting the form, when it should go to a url, it adds the :80/ to the primary url of the workspace. Also, it seems to be switching from https giving me an error in Chrome that says “Your connection to this site is not fully secure.”

Any ideas? Thanks!

Wow! This is the only solution that worked.