Discussion:
[polymer-dev] No 'Access-Control-Allow-Origin' header is present on the requested resource
Abhilash Sathe
2016-11-07 11:32:17 UTC
Permalink
XMLHttpRequest cannot load http://serverthati'mrequesting.com?id=1. No
'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:8080' is therefore not allowed access. I used CORS
add on in chrome and then it works. But otherwise it doesn't. How can I fix
this? I'm using node js server. polymer-cli tools.


<*iron-ajax*

*id=**"requestRepos"*

*headers=**'{"Accept": "*/*"}'*


*url=**"*http://serverthati'mrequesting.com*"*

*params=**"{{requestParams}}"*

*handle-as=**"json"*

*on-response=**"handleResponse" *></*iron-ajax*>

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/7cccf55b-bb88-49b5-81ab-9c1f0c864d1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Daniel Llewellyn
2016-11-07 14:16:39 UTC
Permalink
Post by Abhilash Sathe
XMLHttpRequest cannot load http://serverthati'mrequesting.com?id=1. No
'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:8080' is therefore not allowed access. I used
CORS add on in chrome and then it works. But otherwise it doesn't. How can
I fix this? I'm using node js server. polymer-cli tools.
The server that is hosting your javascript and html imports (serverthati'
mrequesting.com per your example) needs to add the HTTP header (the
domain-name in your example should be "localhost"):

Access-Control-Allow-Origin: <domain-name of your site>

OR to allow everyone to use those assets:

Access-Control-Allow-Origin: *

The actual configuration of your server is probably beyond the scope of
this list. If "serverthati'mrequesting.com" is running Apache then you can
find documentation here:
https://httpd.apache.org/docs/current/mod/mod_headers.html#header Which
suggests to add into your server config a line similar to (for your
example):

Header add Allow-Access-Control-Origin localhost

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CABtuYwchWzT2rtL5EJwazCGQWY%3DYAe5Fv%2B%3D%3DaHwVJcJXN%3D3fQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Daniel Llewellyn
2016-11-07 14:18:23 UTC
Permalink
Post by Daniel Llewellyn
Header add Allow-Access-Control-Origin localhost
I mistyped the header name here. It should be
"Access-Control-Allow-Origin". Sorry :-)

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CABtuYwe1xjZsckKLoQO0fYExERRCX5QwRG%2BTTiF3y6g%3DWz1XmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Abhilash Sathe
2016-11-07 14:28:07 UTC
Permalink
Yes, it's an Apache Tomcat server. So, I guess, I'll need to add the the
Allow CORS tag snippet in that.
Post by Daniel Llewellyn
Post by Abhilash Sathe
XMLHttpRequest cannot load http://serverthati'mrequesting.com?id=1. No
'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:8080' is therefore not allowed access. I used
CORS add on in chrome and then it works. But otherwise it doesn't. How can
I fix this? I'm using node js server. polymer-cli tools.
The server that is hosting your javascript and html imports (serverthati'
mrequesting.com per your example) needs to add the HTTP header (the
Access-Control-Allow-Origin: <domain-name of your site>
Access-Control-Allow-Origin: *
The actual configuration of your server is probably beyond the scope of
this list. If "serverthati'mrequesting.com" is running Apache then you
https://httpd.apache.org/docs/current/mod/mod_headers.html#header Which
suggests to add into your server config a line similar to (for your
Header add Allow-Access-Control-Origin localhost
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/c125d999-49cd-4010-ae76-7f2ad73a35c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Loading...