I'm currently building a Hal Hateoas RESTful API with BazingaHateoasBundle and Symfony 2.7
Here is my config file :
MyBundle\Entity\MyEntity:
relations:
- rel: self
href:
route: get_myentity
parameters:
id: expr(object.getId())
absolute: true
In local, I have an apache with a virtual host and my responses are correct :
{
"id":1,
"_links": {
"self": {
"href": "http://dev.myvhost/api/myentity/1"
}
}
In my dev server, I have something like this:
{
"id":1,
"_links": {
"self": {
"href": "http://my-machine-name/api/myentity/1"
}
}
I don't want my-machine-name
but my-server-name.com
instead.
And my server Apache config look like this :
ServerName my-server-name.com
Alias "/api" "/var/www/api/web"
<VirtualHost *:80>
<Directory /var/www/api/web>
AllowOverride None
Require all granted
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /api/app.php [QSA,L]
</IfModule>
</Directory>
<Directory /var/www/api/web/bundles>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
</Directory>
ErrorLog /var/log/httpd/api_error.log
CustomLog /var/log/httpd/api_access.log combined
</VirtualHost>
Is there a way to configure Symfony so that I can set directly the host maybe ?