Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7762903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:31:43+00:00 2026-06-01T14:31:43+00:00

Ok, It looks like I made a mistake with my initial question. So, here

  • 0

Ok, It looks like I made a mistake with my initial question. So, here are some corrections. The answer still applies, because the second redirect is stopped when there is a change in protocol to HTTPS (SSL).

In my case, I have a redirect occurring multiple times, and the browser doesn’t follow the second redirect. The first redirect is followed but returns an error.

I keep reading that JavaScript AJAX responses containing redirects are followed automatically, but it look like not in my case. The first redirect is automatically followed by the browser, and the first redirect is returned without following the second redirect in the header. My problem is that I want all the redirects to be automatically followed by the browser.

The redirects are part of the phpCAS library. I have an API written in PHP which checks the user authentication, each time, before returning the results.

Here is the sequence. The main thing to note is that the browser returns the second response, after following 1 redirect. I would prefer it went all the way and returned the last response when I make an AJAX call to localhost/example/api.

localhost/example

  • Calls localhost/example/api using jQuery.ajax()

Response 1: localhost/example/api

  • Redirects to https://localhost/accounts/cas/login?service=api.example.com&gateway=true (using SSL).

Response 2: (SSL) localhost/accounts/cas/login?service=api.example.com&gateway=true

  • When the query key ‘gateway’ is present, the login simply redirects back to the URL provided by the ‘service’ key with or without a ticket (to signal to service that the user is either logged in or not).

Response 3: localhost/api?ticket=TICKET

  • Verifies the ticket and redirects back to itself without the ticket.

Response 4: localhost/api

  • This time the CAS client looks at the $_SESSION to remember what the ticket was, and then processes the API request returning JSONP.

There’s no particular reason I’m using CAS over OpenID or OpenAuth(orization). CAS was just the first authentication module I was able to get working in WordPress. I am open to suggestions in terms of using a different authentication library, CMS, framework, etc. Although, my hope is to just get this project finished. So the less re-tooling the better.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:31:45+00:00Added an answer on June 1, 2026 at 2:31 pm

    As you later found yourself as you added in your comments, ajax requests are subject to same origin policy.

    Yes, you could use JSONP – however, if you are fortunate enough to have to support only IE8 and upwards, CORS might be a better solution.

    Basically, adding headers such as

    access-control-allow-origin: http://api.example.com
    access-control-allow-credentials: true
    

    to your server answer, you could work around cross origin policy.

    Also see this jQuery ticket to make it kinda work with jQuery.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've made a hundred of screenshots from iPhone thru Organizer but it looks like
I made an android project using eclipse. It looks like: src/ ActivityMain.java lib/ Square.java
I made a class which looks something like. class NewInt: def __init__(self, x,y): self.holders
Looks like here in StackOveflow there is a group of F# enthusiasts. I'd like
I have a text which looks like: some non interesting part trans-top body of
For some reason, if a mistake is made on my form the url variables
First of all my tree is made up of nodes that look like this:
Can a jQuery UI Slider be made to look like this? If so how?
Looks like while( condition ) { //do stuff } is completely equivalent to for(
Looks like ExpressionTrees compiler should be near with the C# spec in many behaviors,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.