bashy
bashy
3 months ago (996,910 XP)

Cloud9 probably use some sort of reverse proxy and Laravel is adding the port on the end some how. Probably getting printed out for the URL and Laravel just reads it.

@Snapey app.url is only for console related stuff, not front-end so to speak?

Snapey
Snapey
3 months ago (898,985 XP)

@bashy not just console? Anywhere there is no request object off which to create a fully qualified URI. For example creating a button link in an email

WallyJ

Again, to note. I have another form that works fine. But it's action is [email protected] The form submission that adds the port 80 is using URL as its action. So it definitely seems to be a Laravel issue, though some things like this is a little bit of server and framework.

WallyJ

@bashy, Any idea how I could circumvent this? Or should I just look at switching to Homestead? Or even a dedicated server? I've got an old PC in the garage that I could turn into a Linux box and put it on my network. I'm willing to do whatever is most likely to work. The only thing C9 brings to me is being able to develop anywhere I have an internet connection, which isn't really something I HAVE to have at the moment. Thoughts?

bashy
bashy
3 months ago (996,910 XP)

@Snapey Yeah that's not front-end and I think of that as console based (not served from a direct request).

https://github.com/laravel/framework/search?utf8=%E2%9C%93&q=%22app.url%22&type= some idea of where it uses it.

@WallyJ Never had that and no real idea of why. You'll want to dump out the $_SERVER/$_REQUEST stuff to see what HTTP_HOST is and stuff.

jonjie

Hi @WallyJ .. Can we see your route for the post?

WallyJ

Thanks @jonjie !

Here is my route:

Route::post('/contacts/{contact}/contactnotes', '[email protected]');

Here is the Controller:

public function store(Contact $contact, Request $request)
    {
        //add a contactnote to a contact
        $contact->addContactnote(request('contactnotetext'));
        
        return back();
        //return redirect('/contacts/{{$contact->id}}')->with('success', 'Note Added');
    }

Which calls a function in the Contact model:

public function addContactnote($contactnotetext)
    {
            $this->contactnotes()->create(compact('contactnotetext'));
            
    }

Not sure what is causing the issue, but I'm ready to change my development environment, if necessary, to fix it.

Thanks!

vmitchell85
WallyJ

@vmitchell85 , thanks for mentioning the article. If you read all the way to the bottom you can see that I commented on the article because I tried the fixes mentioned in the article concerning my conf file, etc.

I'm just ready to get onto developing again. I may switch back to Homestead on my Windows 10, 64 bit machine. That seems to be a community with a lot of support. I have written Cloud9 and am not receiving a timely response.

vmitchell85

@WallyJ Sorry... I missed your reply

I also found this: https://laracasts.com/discuss/channels/general-discussion/redirectroute-adds-80-to-url-causes-error

Are you returning a redirect in this instance and not in the other Form instance you mentioned?

WallyJ

Yes. One form has an action of a controller. The other has a URL as its action.

jonjie

Hi @WallyJ .. have you tried to add a name to your route? and use it instead?

WallyJ

@jonjie , I appreciate you asking, but I know that my code should work, and I don't want to start coding differently just because my development environment demands it of me, when it shouldn't, especially as I'm learning.

To be clear, if I run the server on Cloud9 normally, I have this problem. If I launch the server from the console using the command:

php artisan serve --host $IP --port $PORT  

My app/form works just fine. However, when I launch the server this way, I can no longer reach PHPMyAdmin (I know, the flaming can commence). But I need to use it.

I was hoping that there was something in a config file that I could change to make it work normally, but nothing is working, and trust me, I have read ALL the articles there are to be found on Google. Thanks.

Please sign in or create an account to participate in this conversation.