Error reading a RSS/JSON from my Server


I am trying to read a RSS/JSON from my own server and I am always getting this error:


Here is my code:

import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { Observable }     from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';

export class FeedService {

  private feedUrl:string = '';  

  constructor(private http: Http) {}

  getItems(): Observable<any[]> {
    return this.http.get(this.feedUrl)

  private extractData(res: Response) {
    let body = res.json();
    for (var i = 0; i < body.length; i++) {
      if ( body[i].thumbnail ) {
        body[i].thumbnail = body[i].thumbnail.split(',')[0].replace(' ', '?');
      body[i].interested = localStorage.getItem(body[i].id + 'Interested') === 'true' || false;
      body[i].going = localStorage.getItem(body[i].id + 'Going')  === 'true' || false;
      body[i].ignore = localStorage.getItem(body[i].id + 'Ignore')  === 'true' || false;

      console.log('extractData', body);
    return body || { };

  private handleError (error: any) {
    let errMsg = (error.message) ? error.message :
      error.status ? `${error.status} - ${error.statusText}` : 'RSS Server error';
    return Observable.throw(errMsg);

Any help, please?

did you solve it? I’m also facing same in rc0.

Yes, I’ve added the header (server side):
header(“Access-Control-Allow-Origin: *”);

And now its working! :slight_smile:


Thanks a ton. Struggled too much to solve it, it was working in beta 11 so I thought my server is fine. Saved my half day, already wasted half :stuck_out_tongue:

1 Like

I am also getting this problem… How i need to solve this…??

here im using a RDS on AWS, and when i try to post a json from ‘ionic running on device’ to the uri, i get the same error response…i’ve been trying to figure out how to add that header you talk about in the server side but i just cant find the answer…

Im using api gateway to get the json sent from device, and pass it to a lambda function (where i make some insert queries to insert values on mysql database)

I am finding the same issue do you guys find any luck solving it ?

I used this code:
Server side: header(“Access-Control-Allow-Origin: *”);
Client side: let headers = new Headers({ “Content-Type”: “application/x-www-form-urlencoded” });
And the problem was solved

Instead of doing this, I would recommend making your request body a URLSearchParams, at which point HttpClient will set the content type header properly for you.