I need to access http://www.wienerlinien.at/ogd_routing/XML_TRIP_REQUEST2?locationServerActive=1&type_origin=any&name_origin=60201095&type_destination=any&name_destination=60200769 (returns an XML file)
->This causes a cross origin request Error (unfortunately service is only available via http).
I also enabled cross-origin in my server. Howevery without any success.
gulp.task('browser-sync', function () {
browserSync({
notify: true,
port: 8000,
server: {
baseDir: "dist",
middleware: function (req, res, next) {
res.setHeader("Access-Control-Allow-Origin", "*");
next();
}
}
});
});
This is the function which performs the http request:
this.requestjourney = function (id1, id2) {
var promise = $http({
method: 'GET',
timeout: 5000000,
// url: "http://www.wienerlinien.at/ogd_routing/XML_TRIP_REQUEST2?locationServerActive=1&outputFormat=JSON&type_origin=any&name_origin=Reumannplatz&type_destination=any&name_destination=Stephansplatz",
url: "http://www.wienerlinien.at/ogd_routing/XML_TRIP_REQUEST2?locationServerActive=1&type_origin=any&name_origin=" + id1 + "&type_destination=any&name_destination=" + id2,
locationServerActive: 1,
excludedMeans: 0,
excludedMeans: 1,
excludedMeans: 3,
excludedMeans: 4,
excludedMeans: 5,
excludedMeans: 6,
excludedMeans: 7,
excludedMeans: 8,
excludedMeans: 9,
excludedMeans: 10,
excludedMeans: 11,
contentType: 'application/x-www-form-urlencoded; charset=utf-8'
});
return promise;
}
Is there any kind of cook book solution fixing cross oringin request in angularJS? Or Workaround ?
Thanks in advance, Wolfgang