On Thursday, March 16, 2017 at 8:08:06 AM UTC+1, amadese wrote:
>
> Hi,
>
> I have problem with my application in Coldfusion 11 (main page: 
> http://hostname/myapplication/). 
> I'm trying (with *angularJs 1*) to implement the routes. 
>
> The page contents different links like:
>
>    -  http://hostname/myapplication/index.cfm#/all-contacts
>    -  http://hostname/myapplication/index.cfm#/add-contacts
>    -  http://hostname/myapplication/index.cfm#/view-contacts/10890
>
>
> *My problem:* a parameter "ticket" (due to an authentication system) is 
> inserted in the url of the page when the page is called:
>
> http://hostname/myapplication/index.cfm?ticket=12345#/add-contacts
>
> The ticket is not inserted at the end (I don't know the reason) and the 
> page is called but the data are not correctly retrieved. When the page is 
> called, some AJAX queries defined in the controlers and factories are 
> executed.
>
> The url generated for doing AJAX appears in the console with this error:
>
>     GET http:
> //hostname/myapplication/countries.cfc?method=getCountries&countryid=undefined
>         
>     --> 302 Document Moved
>     
>     Cross-Origin Request Blocked: The Same Origin Policy disallows 
> reading the remote resource at 
> https://loginsystem/login?loginRequestId=blabla. 
> (Reason: CORS header 'Access-Control-Allow-Origin' missing).
>
>
> I think that when the page or an AJAX query is loaded, our authentication 
> system tries each time to reload.
>
> Do you have an idea for solving this issue? Is it a problem of Angular, of 
> the CF11 server or a problem of the authentication system?
>
> Is it possible before calling a page to clean the url (delete the 
> parameter "ticket") for allowing to the route to be working ? I would like 
> to test this kind of solution for solving the problem.
>
> Could you please help me for solving this problem?
>
>
Well, two things, if I understood all this correctly.

First, if you want to intercept your service requests (AJAX), you can use a 
httpInterceptor. It's basically a piece of code which tells angular what to 
do with *any or all* requests to backend.
Look up "Interceptors" section at this page:
https://docs.angularjs.org/api/ng/service/$http

But basically, you'd create an interceptor that looks up the *ticket* parameter 
and deletes it, if it's present.

But second and more important, I don't think that's the problem. You have a 
CORS problem, it seems. Basically your calls from *https://yourserver/* to 
*https://loginsystem/* fail because a) your *loginsystem* server doesn't 
allow cross-origin requests from *yourserver,* - which you can also set 
with either proper config or an interceptor in your angular app.


 

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to