When working with API it’s important to set up CORS headers to support Web Client (Browser) requests.
Common solution for most of Rails developers is to create
with custom headers.
Well that’s WRONG.
What you should do instead is to setup CORS at the (Rack)[http://rack.github.io] middleware level before your Rails routes. Routes only accessible after HTTP OPTIONS method succeeded on the web client.
Rack Cors is helpful if you don’t want to write your own middleware.
make sure that you serve CORS at the top of the stack or at least before middleware you need (in my case I had
All above is an OK setup for Heroku, (Aptible)[https://www.aptible.com] or other services that allow you to deploy your app with cli gem but won’t let you access higher stack like Nginx or Apache
“The proper way” of handling Cross-origin is to set it up at the Nginx level. So your Rails app is only busy with serving API.
Almost any reasonable deploy process now requires a docker box. Docker is awesome but I’d rather have an isolated environment for my containers.
Here is where vagrant’s docker priovider comes in to play. Vagrant guys did a great job explaining abstraction here.
As always things are not so easy when you actually try to implement Vagrant Docker Proxy/Host on your own.
After a day of googling errors caused by
I figured that Vagrant is too green for automating Docker installation.
Another issue came up after I failed to install Docker on linux box.
Even if you get Docker instaled you instantly get a permission error.
All issues above fixed with custom
curl -sSL https://get.docker.com/ubuntu/ | sudo sh &&
Today I realized that there are about 2000 of messages / voicemail in my Google Voice account. By default Google will only allow 10 messages to be removed in one shot. Then you’ll find deleted messages in “History” which you also need to clean up.
I hate to leave all this text about me laying around on Google servers.
So here’s the gist of a code that will remove all of your messages from Google voice.
WARNING: this code will delete everything from your account. So use it cautiously!
This is first post for the Overengineering blog. I will be posting more usless or usefull stuff as I feel like sharing.
If want some details please let me know in comments…