Quantcast
Channel: Active questions tagged servlets - Stack Overflow
Viewing all articles
Browse latest Browse all 675

Google app engine: call from another domain not working

$
0
0

calling an app engine (jetty @WebServlet) from another domain gives an error. In the logs I see the 'preflight' successful result, but the servlet code is not reached (a printout as the first line does not appear in the logs). Making the call from a browser works. no authorization involved. tried CORS in app.yaml, no success. not a custom domain

  1. from browser works and same call from a localhost app does not work
  2. preflight call shows up in the logs for both browser and localhost call. the first line log printout of the webservlet code appears in browser call and not for localhost call
  3. tried CORS handler in app.yaml, did not help
  4. no firewalls restrictions defined in app engine project
  5. not a custom domain

Angular call to code:

public getNewCatalogObject(id: string): Observable<any> {            //const cataloginfoshttp = environment.apiURL +'/'+ CatalogInfo +'?catalogname='+ id;            const cataloginfoshttp = environment.apiURL+'/'+ CatalogInfo;            const params = new HttpParams().set('catalogname',id);            const headerdata = new HttpHeaders()                .set('Access-Control-Allow-Origin', '*')                .set('Access-Control-Allow-Methods','GET')                .set('Access-Control-Allow-Headers','Content-Type');            alert("OntologycatalogService without params: " + cataloginfoshttp);            alert("OntologycatalogService params: " + params.toString());                    return this.httpClient.get(cataloginfoshttp,{ 'params': params, 'headers': headerdata })

Webservlet code:

@WebServlet(name = "CatalogInformationServlet", urlPatterns = { "/cataloginfo" })public class CatalogInformationServlet extends HttpServlet {    private static final Logger logger = Logger.getLogger(CatalogInformationServlet.class.getName());    @Override    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {        logger.info("CatalogInformationServlet");

preflight log from google app

{"protoPayload": {"@type": "type.googleapis.com/google.appengine.logging.v1.RequestLog","appId": "e~blurock-database","versionId": "2","requestId": "660fa92c00ff0ba0838e379e6f0001657e626c75726f636b2d6461746162617365000132000100","ip": "212.247.157.170","startTime": "2024-04-05T07:33:00.777537Z","endTime": "2024-04-05T07:33:00.786930Z","latency": "0.009393s","megaCycles": "188","method": "OPTIONS","resource": "/cataloginfo?catalogname=dataset:ThermodynamicContributions","httpVersion": "HTTP/1.1","status": 200,"responseSize": "152","referrer": "http://localhost:4200/","userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:124.0) Gecko/20100101 Firefox/124.0","urlMapEntry": "auto","host": "blurock-database.ew.r.appspot.com","instanceIndex": -1,"finished": true,"instanceId": "00a22404dc913688c9e38d2629cbacea000cd13536d1f9f80d60c2b1277a5df1d41f6afb14979e602dd05cb917c3b4e549604721c4b8ed59aefae040a2b7f9e71d67","appEngineRelease": "1.9.71","traceId": "c2a4b7970a7899c6b6b8ddc84334ef73","first": true,"spanId": "10870129278550620427"  },"insertId": "660fa92c000c0273cf4bdb2d","httpRequest": {"status": 200  },"resource": {"type": "gae_app","labels": {"zone": "eu6","version_id": "2","module_id": "default","project_id": "blurock-database"    }  },"timestamp": "2024-04-05T07:33:00.777537Z","labels": {"clone_id": "00a22404dc913688c9e38d2629cbacea000cd13536d1f9f80d60c2b1277a5df1d41f6afb14979e602dd05cb917c3b4e549604721c4b8ed59aefae040a2b7f9e71d67"  },"logName": "projects/blurock-database/logs/appengine.googleapis.com%2Frequest_log","operation": {"id": "660fa92c00ff0ba0838e379e6f0001657e626c75726f636b2d6461746162617365000132000100","producer": "appengine.googleapis.com/request_id","first": true,"last": true  },"trace": "projects/blurock-database/traces/c2a4b7970a7899c6b6b8ddc84334ef73","receiveTimestamp": "2024-04-05T07:33:00.903523715Z","spanId": "10870129278550620427"}

Unsuccessful attempt to add CORS To app.yaml handler:

- url: /cataloginfo  login: optional  secure: optional  static_dir: /__static__  http_headers:    Access-Control-Allow-Origin: "*"    Access-Control-Allow-Methods: "GET, POST, PUT, DELETE, OPTIONS"    Access-Control-Allow-Headers: "Content-Type, Authorization"    Access-Control-Max-Age: "3600"

Viewing all articles
Browse latest Browse all 675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>