Azure Front Door having problem with forwarding Authentication Bearer token

Alex 475 Reputation points
2025-03-04T05:51:07.0566667+00:00

Hello all,

I am experimenting a design as below and ran into some issues. Would be helpful if you can assist on the same.

Design:

  • I have an AWS S3 exposed via AWS Cloudfront with a custom domain already (say oldsite.com).
  • Now I am trying to configure Azure Frontdoor's already exposed domain to have a RuleSet to override the origin based on request path.
    • Say, newsite.com is exposed in Azure frontdoor and all /* requests goes to Azure backends.
    • Now, in the ruleset, for newsite.com/fd/images, I override with another origin group which is the AWS Cloudfront domain.

Outcome:

Problem:

  • When I pass the Authorization Bearer token in the request, I get below error
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
      <TITLE>ERROR: The request could not be satisfied</TITLE>
      </HEAD><BODY>
      <H1>ERROR</H1>
      <H2>Failed to contact the origin.</H2>
      <HR noshade size="1px">
      </BODY></HTML>
    

Queries:

I am aware that this design of CDN to CDN is unique / even bad, but I am experimenting/researching something, so

  • What am I doing wrong here?
  • Why is it that Frontdoor was able to forward the request to the AWS Cloudfront origin when the request didn't have the auth bearer token, but fails to even contact the origin when the token is passed? (Btw, I added a custom response header to confirm that the response is from this ruleset and not the other default route).
    • Does it mean, Azure FD doesn't forward the auth bearer token or something like that? If yes, how to force it to forward?
  • Any other pointers to check?

Thank you for your time and support.

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
776 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ganesh Patapati 4,150 Reputation points Microsoft External Staff
    2025-03-06T09:14:37.14+00:00

    @Alex

    Greetings!

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!

    Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others", I'll repost your solution.

    Please click "Accept" the answer as original posters help the community find answers faster by identifying the correct answer.

    Issue: Azure Front Door having problem with forwarding Authentication Bearer token

    Resolution: I found out the reason why it was failing. It wasn't the Auth bearer token not being forwarded, but the URL rewrite was missing in my ruleset.

    • Actually, the flow is
      • newsite.com/a/b/old/images/image1.png -> Azure FD TO oldsite.com/images/image1.png -> AWS CF.
    • AWS CF is configured only for the request path /images/*, so when FD was forwarding with /a/b/old/images/image1.png, AWS CF was responding with 502 because of no request mapping configured for that path.
    • So, in Azure FD ruleset, before route override to AWS CF, I did a URL rewrite as below
    • Source: /a/b/old/ Destination: / Preserve unmatched path: Yes

    I hope this has been helpful!

    Your feedback is important so please take a moment to accept answers. If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!

    Accepted answerPlease accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.