Forums

https questions

Hi there. I have some simple code to upload a csv and display a table using an AngularJS partial.

It works fine over regular http. If I switch to https, it doesn't work. Any ideas?

Edit: I'm using Flask and I think this is a clue: https://github.com/pallets/flask/issues/773

Are you loading the CSV (or perhaps something else) over HTTP rather than HTTPS? A good place to check is the browser's developer console -- when mixed HTTP/HTTPS stuff gets blocked by the browser for security reasons, an error is normally displayed there.

Hi @giles, thanks a lot. Works if I'm using only http. Once I introduce https, something doesn't work all the way through, so I'll bet you're right. Checking. Thanks again.

It looks like if I say to redirect to my https url all is fine. However with a relative path, it's not. I doubt using a full path is the preferred solution. I found this article on this topic (kinda note to self and note in case it helps someone else):

http://flask.pocoo.org/snippets/93/

can you clarify? when you say relative vs full, do you mean whether you specify http vs https in the url itself? and are you accessing the original page over http or https?

Yes if I use a redirect (from Flask) to /foo/bar, after starting with an https page initially, something gets unhappy. In my initial testing, hardcoding the path to begin with https clears things up, but I am not sure of any details yet.

In general, if you try to load an HTTP page from JavaScript (which includes Angular, of course) on a page that was loaded via HTTPS, the browser will block it -- there are security reasons to do that (though in some cases you just get an error -- I'm not entirely sure of the details). So that was likely the cause of the problem.

Ah... that's probably the issue. I try to load a partial via Angular after my csv to pandas df step completes. That is likely trying to load via http. Thanks for these ideas.

It should be possible to tell Angular to load stuff over HTTPS -- it might be as simple as changing a URL in your config code. (Sorry for lack of details, it's been a while since I've done any Angular stuff.)