Auth0 Home Blog Docs

Add Custom Headers to Redirect Rules

redirect-rules
#1

Hi,
As the title says I am tyring to send a custom header to my server in a redirect rule. I couldn’t find anything in the documentation, I even tried creating the redirect like so:
context.redirect = {
url: “http://localhost:8080/header-test”,
headers: {
“X-Test-Header”: “pleasepleasepleasework”
}
};

It didn’t work… so I think this post might be a feature request :slight_smile:

#3

Hey there @dblackhall-tyro!

I’m not sure it’s doable using rules but let me investigate it before making a feature request for you! :slight_smile:

#4

I just found out that we have a doc around that. Here it is:

Have you tried giving it a look? I’'ll relay your feedback to our product team.

#5

I have taken a look at that doc, but I couldn’t see anything about passing headers to my redirect url.
And after further investigation I’m fairly sure this is not possible :frowning: The redirect happens in the browser and I don’t think there is a way to instruct the browser to include custom headers when redirecting to my url.
I’m happy to be proven wrong though!

#6

Sure! I’m trying to discuss it internally will get back to you with what we got otherwise I’ll open a feature request :slight_smile:

#7

As of now I’m sure you can use the request library in rules to make HTTP calls so whatever that library allows you should be good. The only restriction is that not all versions of request may be available in rules.

#8

Hey there @dblackhall-tyro!

It seems like no-one is like 100% sure about that. I’ll submit a product request for that and see how our product team reacts :slight_smile: