Port 80 getting added to URLs after POST

Published 1 month ago by WallyJ

I have a form that, when submitted, goes to the correct url, but the url has an extra port 80 in it for seemingly no reason.

URL that I should reach: https://re-crm-wallyj.c9users.io/contacts/4/contactnotes

URL that I reach: https://re-crm-wallyj.c9users.io:80/contacts/4/contactnotes

I'm thinking it's a config issue. I'm developing on a C9 server.

Thoughts? Thanks!

Snapey
Snapey
1 month ago (924,495 XP)

what is the app_url in .env or config

WallyJ
Snapey
Snapey
1 month ago (924,495 XP)

And this is just when you post the form?

what does the action look like on your form

WallyJ
<div class="card-block">
          <form method="POST" action="/contacts/{{ $contact->id }}/contactnotes/">
          {{ csrf_field() }}
          <div class="form-group">
             <textarea name="contactnotetext" placeholder="Your note here" class="form-control">
             </textarea>
          </div>
          <div class="form-group">
             <button type="submit" class="btn btn-primary">Add Note</button>
          </div>
          </form>
</div>
Snapey
Snapey
1 month ago (924,495 XP)

So the router should create links that are based on the current request.

Only if the link loading the form has :80 appended, will the action also have :80 appended?

Unless you have some strange config on your web server that is rewriting the requests?

WallyJ

I am using Cloud9 with their online servers. It's running Apache, PHP, MySQL, and PHPMYAdmin. Pretty standard stuff. I have found other forum posts with this problem, but not any answers that work on my Cloud9 server. I have sent Cloud9 support an email but they haven't figured it out yet either. I have found the issue from others using Laravel, so I don't think it's a Cloud9 issue. I think it's a Laravel issue.

Snapey
Snapey
1 month ago (924,495 XP)

So, you are happily navigating around your site... at what point does :80 appear?

WallyJ

Only when I post the form. I have another form that works fine. That form uses a controller as its action instead of a URL.

I may switch the way my broken form works, but I shouldn't have to.

Thanks for your help.

WallyJ

I wish I could figure this out because I just want to develop without the headaches of a server that wants to act up. Any other ideas that you have is helpful.

Cronix
Cronix
1 month ago (334,240 XP)

Yeah, use a real server that you have control over. Digital Ocean droplets start at $5/month.

WallyJ

If I go with Digital Ocean, do I have to install Apache and PHP and mysql, etc.?

And do they have a built in editor like Cloud9?

Cronix
Cronix
1 month ago (334,240 XP)

Yes, but I use laravel forge which sets all that up, along with redis and everything else that a stock laravel install would use.

They do have guides on how to install for Laravel: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-laravel-application-with-nginx-on-ubuntu-16-04

WallyJ

I'm down for using Forge. Do they have an online editor or do I have to set up a local server and then push my files to Forge?

Cronix
Cronix
1 month ago (334,240 XP)

If you use Forge, I'd recommend developing on Laravel Homestead. It's the same Ubuntu install that Forge uses, except Forge (being the live site) has more security in place as far as the OS. It's the best of both worlds because you are developing in the exact same environment as your live server, so you know everything will just work.

The best workflow is to have a github repo, or other web based git repo like BitBucket, with your code. They can be either public or private repos. You can easily set up Forge to use that account and use automatic deployments. You tell it which repo and branch to watch, usually master, and anytime you commit or merge to master it will automatically push the changes to your server, so you don't have to do a thing. It can even do things like run artisan migrate to migrate your databases, and anything else you normally do.

WallyJ

I appreciate your idea for a full development to production environment setup, and I would like to ultimately land in a setup like that. I installed Homestead a while back and struggled with problems it was giving me, so I uninstalled it and went with Cloud9, which would supposedly going to alleviate my server issues and just allow me to debug my newbie code.

If I'm being frankly honest, I am trying to limit the frustration factor as a newer developer. I have spent a lot of time troubleshooting server issues when I would just like to code. I spend enough time troubleshooting my code as I am learning. I quit coding a couple of years ago due to the amount of time I was getting nothing done. I have decided to give it another go, so I am really trying to get a server setup that will do its job long enough for me to get my first full app built. I appreciate your help, but I need simple and working, as quickly as possible. I'm focused on my development environment. I can setup the deployment part later. Thanks again.

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