workarea-commerce / workarea-api

Adds JSON REST APIs to the Workarea Commerce Platform
https://www.workarea.com
Other
7 stars 1 forks source link

Ensure Port Is Not Specified In Storefront API URL Helper #26

Closed tubbo closed 4 years ago

tubbo commented 4 years ago

In some QA/Staging environments, generated URLs in the API include an incorrect port (:3000). This is caused by the fact that the Rails server is running in a container, bound to port 3000, and the request.port is different from the normal 80/443 defaults, thus Rails automatically specifies it as part of the URL. To get around this, always pass in a custom :port to the URL helper method that is called as part of storefront_api_url_for. In non-development environments, this port will always be nil, but for development :3000 will still be used for those who use a local Rails server for development at localhost:3000.