-
-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$baseUrl not using correct port with Vagrant virtual machine #325
Comments
Btw, glad to submit a PR for 1 or 2 if you like. |
… url and multi base url configurations. Closes #325
You have made a very valid point @richardkmiller 👍 I have taken solution 1 and improvised on it :) You can add one or more baseUrls, when you add more than one, restler will pick the right one based on in your case the following should make it work inside and outside vagrant $r = new Restler();
$r->setBaseUrl('http://localhost','http://localhost:8088');
//... The above commit is in latest v3 branch and will be part of RC6 when released. Please test and let me know! We welcome your contributions to Restler 👍 |
@Arul- Thanks! That will work great for our needs! However, I am currently getting a warning on this branch: I tried The call to
|
… url and multi base url configurations. Closes #325
It should be fixed now, check it out! |
Interestingly, it works when I list my preferred hostname last: But not if I list it first: |
…ch except for the port. Related to #325
Taken care of the issue! Please check again! |
Well, it worked in development but not in production. Here's my full configuration including production:
There are 5 services machines running this code, named services1-5. There's also a round-robin DNS entry "services" that points to the 5 services machines. If you visit http://services, your browser will choose one of the five machines. I'm seeing erratic behavior. For example, if I visit |
It seems to work correctly, see my test below <?php
require '../vendor/autoload.php';
use Luracast\Restler\Restler;
$r = new Restler();
$_SERVER['HTTP_HOST'] = 'http://services1';
$r->setBaseUrl(
'http://localhost:8088',
'http://localhost',
'http://services1',
'http://services2',
'http://services3',
'http://services4',
'http://services5',
'http://services'
);
dd($r->getBaseUrl()); I changed the
|
@Arul- Is the I think you're correct that Could this be solved by doing an equality match |
@Arul- Thank you for your help with this! |
The as my |
I also made sure to select the first url when none of them match, in the recent commit! |
I assume this issue is fixed as I did not hear back from you so far! Please re-open the issue if its not! |
… url and multi base url configurations. Closes #325
…ch except for the port. Related to #325
… url and multi base url configurations. Closes #325
…ch except for the port. Related to #325
… url and multi base url configurations. Closes #325
…ch except for the port. Related to #325
… url and multi base url configurations. Closes #325
…ch except for the port. Related to #325
… url and multi base url configurations. Closes #325
…ch except for the port. Related to #325
…e given list. Also renamed the method to setBaseUrls to better convey the purpose. Related to #325
… url and multi base url configurations. Closes #325
…ch except for the port. Related to #325
…e given list and adds support for specifying the http port. Also renamed the method to setBaseUrls to better convey the purpose. Related to #325
… url and multi base url configurations. Closes #325
…ch except for the port. Related to #325
…e given list and adds support for specifying the http port. Also renamed the method to setBaseUrls to better convey the purpose. Related to #325
… url and multi base url configurations. Closes #325
…ch except for the port. Related to #325
…e given list and adds support for specifying the http port. Also renamed the method to setBaseUrls to better convey the purpose. Related to #325
Related to #175. When using Restler in development with a Vagrant VM, I'm using port 80 on the inside of the VM and port 8088 on the outside (port forwarded). Because
$_SERVER['SERVER_PORT']
is set to 80 on the inside of the VM, Restler sets$baseUrl
tolocalhost
instead of the correctlocalhost:8088
.Solutions:
setBaseUrl()
so I can set$baseUrl
manually.getPath()
could use$_SERVER['HTTP_HOST']
instead of$_SERVER['SERVER_NAME']
+$_SERVER['SERVER_PORT']
.$_SERVER['SERVER_PORT']
before Restler runs, as suggested in Incorrect $baseUrl problem & fix #175 for$_SERVER['SERVER_NAME']
, but that seems problematic as it might break something else?Thanks!
The text was updated successfully, but these errors were encountered: