align-toparrow-leftarrow-rightbackbellblockcalendarcamerachatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-crosscrosseditfacebookglobegoogleimagesinstagramlocation-pinmagnifying-glassmailmoremuplabelShape 3 + Rectangle 1outlookpersonplusImported LayersImported LayersImported Layersshieldstartwitteryahoo

Re: [javascript-12] Discount code for js everywhere conf

From: Janos M.
Sent on: Thursday, October 25, 2012 10:10 AM
Hello,

We have various development environments shared on one IP address. Each instance has its own non-secure port and secure port. What would be the most elegant way to configure or detect the secure port number in JavaScript for the current instance other than hardcode it?

For example, 8082 has the corresponding https port 2443, 8083 has the https port 3443 and so on.

In production, when the user clicks an https link on an http page, Apache forwards to the right page but returns 302 (permanently moved). I could inspect the Location header containing the URL such as https:// ... /blah from jQuery, however the $.ajax call calls the error handler and xhr.getAllResponseHeaders() returns nothing.

Basically, I need the https port in order to set up the <iframe> for cross-origin communication in development environments.

Any ideas will be appreciated.

Janos

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy