redirect from http to https in angularjs

1,796 views
Skip to first unread message

Jake K.

unread,
Jun 4, 2015, 6:19:49 PM6/4/15
to ang...@googlegroups.com

Hello,

I would like to be able to switch the http to https for all of my $http requests.

The following is the scenario:

When I launch my application to Production, the url in Production is set to HTTPS, therefore all the $http requests, including the requests for Google map must be modified to HTTPS as well.

For now I am thinking of intercepting each request and change the protocol to HTTPS. How can I do this? 

Thanks

PS: please feel free to post a better alternative in case you have one. Thanks

Sander Elias

unread,
Jun 5, 2015, 12:39:14 AM6/5/15
to ang...@googlegroups.com

Hi Jake,

The solution is simple, do not specify the protocol in the URL. Every url that has no protocol specified, uses the same as the base page.

so use href="\\www.somewhere.com\something" in stead of href="https:\\www.somewhere.com\something"

Regards
Sander

Randal L. Schwartz

unread,
Jun 8, 2015, 12:56:05 PM6/8/15
to ang...@googlegroups.com
>>>>> "Sander" == Sander Elias <sande...@gmail.com> writes:

Sander> so use href="\\www.somewhere.com\something" in stead of
Sander> href="https:\\www.somewhere.com\something"

... and it's slash (/) not backslash (\) for URLs. Always has been,
always will be, despite radio announcers speaking to the contrary. :).

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<mer...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix consulting, Technical writing, Comedy, etc. etc.
Still trying to think of something clever for the fourth line of this .sig

Sander Elias

unread,
Jun 8, 2015, 1:18:52 PM6/8/15
to ang...@googlegroups.com, mer...@stonehenge.com
Hi Randal,

Good you discovered my typo! :-)
Otherwise the OP would have no clue whatsoever!

Regards
Sander
Reply all
Reply to author
Forward
0 new messages