Override https errors for regular http calls

Let’s say you are building a web app that has some secure user data involved
in the picture. You have to secure it with https, that is a necessity. So what
happens when you have to include some outside service into your https only
application, and the service sadly doesn’t have an https site, or maybe it has
a self signed certificate? The error pops up, something in the context of This page is only
partialy secure
There is a way to override this, but you are doing it at you own risk. You
really should use only verified https resources in your public facing sites.

There can be many reasons why you would go with this solution, and i’ll leave
them to you to find that out by yourself, i’m just giving you the hammer.

So, you want to override https calls in your app, and it’s a rails app(this
approach can be done using sinatra or anything else ruby based, if you don’t
know how to implement it, contact me and i’ll try to help)

Basically you want to override the outside http call with a call to your own
application, yes this can hurt your performance, but not having a green icon in
the address bar can hurt you even more. I’ll make an example with a simple
JSON call to an external service, but it can be done with any call.

First you should set up a controller to handle these requests, lets say
ExternalResourcesController make an external_json method and add it to the
routes.rb file, of course you need net/http and uri for making the
remote calls.

# app/controllers/external_resources_controller.rb
require ‘net/http’
require ‘uri’
class ExternalResourcesController < ApplicationController def external_json options = { # fill your options with the params you are sending from the application } uri = URI('some external json service url') uri.query = URI.encode_www_form(options) resp = Net::HTTP.get(uri) render json: resp end end [/ruby] [ruby] # config/routes.rb get 'external_resources/external_json', to: 'external_resources#external_json' [/ruby] This approach also gives you the benefit of not having to send and expose all parameters you are sending in client facing JavaScript, and can only send the dynamic ones. That can pay off if you are using this call more than once. And you can call this from your CoffeeScript very easily: [javascript] # app/assets/javascripts/ajax.js.coffee json = $.ajax url: "/external_resources/external_json" dataType: "jsonp" data: first_param_name: "I'm a parameter" second_param_name: "I'm a parameter too" [/javascript] Once again, you should only use this approach if you really, really know what you are doing, i’m not liable for the problems you can cause.

Build your career (You can do better)

Let’s get this clear, this is not a rant against anyone, this is just a
statement. But you must realize this, it is not easy and this is not a one
week fix. Also, I’m not talking about leaving your job and finding a better
one, but improving yourself as a developer. If that consequently gets you a
better job, be it that way.

The first thing you need to do is decide for yourself that you want to do it.
There are lots of 9-5 developers out there that write their amount of code
while at work, then clock out and they are done. I assume you are not one of

So how do you do it? I don’t know yet. I’m trying to find out just like you
are. Writing a blog is a good thing, so you will learn to articulate
your thoughts, or so they say. Don’t be discouraged by the lack of topics, or
afraid of bad reception, you want people to respond to your work, so you can
improve it and be better at it.

Be constructive while appraising someone’s work, maybe it’s the best they have
it in them, or maybe it could be a start of a great career and you ruin it with
your critic. Talking about that, develop a thick skin, learn a way do
weed out non constructive critic, and take the one you get in a best way
intended. Not everyone is a bestseller writer, or a computer language creator.

Invest yourself into opensource projects, there are
lots of resources on starting out. You can join or even start a local
developers or something_users group, something being a language or framework
you like and use. But first and foremost, you must be open to learn, every day
everything that crosses your path is a chance to learn. I’m not talking about
code or tools or even technology in that sense. If you’ve got the time take a
look at the Passionate Programmer, it’s a great book by Chad Fowler. He is also posting
the chapters free on his blog for people to read. I can’t recommend this book

Learn a new programming language, learn a functional programming language,
make a mobile app, make a desktop app, make a web app, step out of your
comfort zone and take a look how other developers are doing it.

Go outside, take a deep breath, exercise, take care of your health. Read
another book: The Healthy Programmer, and enjoy your life a bit differently than while
sitting in a chair in some cubicle in the middle of nowhere.

Do some freelance work, on the side or full time, that will give you the
opportunity to try out new technologies, learn how to deal with clients, learn
project management, estimating, scheduling and everything you are not doing while
just coding 9-5.

So the conclusion is, learn every day, learn something different, step out of
the box and be yourself, the best you can be. You can leave a dent in the
universe, maybe a small one, but it doesn’t matter. Just try and not be a