Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpInclude through proxy with X-Forwarded-For #5835

Closed
kai-tub opened this issue Sep 22, 2023 · 4 comments · Fixed by #5845
Closed

httpInclude through proxy with X-Forwarded-For #5835

kai-tub opened this issue Sep 22, 2023 · 4 comments · Fixed by #5845
Labels
bug 🐞 Something isn't working

Comments

@kai-tub
Copy link

kai-tub commented Sep 22, 2023

As discussed in the forum, I am creating this issue to track the progress of the following discussion: https://caddy.community/t/file-server-httpinclude-with-x-forwarded-for/21087

TL;DR:

Goal: Allow the virtual request of httpInclude of a file_server to include a RemoteAddr so that a reverse proxy can set X-Forwarded-For.

Otherwise, the X-Forwarded-For header is not set and not included in the endpoint that processes the original httpInclude request, which is required for applications that trust this header and return different text data depending on its value.

@francislavoie francislavoie added the bug 🐞 Something isn't working label Sep 22, 2023
@francislavoie
Copy link
Member

For ref, the fix will need to be applied somewhere in here:

virtReq, err := http.NewRequest("GET", uri, nil)

@AshwinKul28
Copy link

Hello, I can take this issue. I will work on it later today. thanks

@francislavoie
Copy link
Member

@kai-tub could you try building from #5845 to confirm the fix? Thanks!

@kai-tub
Copy link
Author

kai-tub commented Oct 7, 2023

Hey, I can confirm that the issue is resolved with the PR requested in #5845 🎉
With the changes, my API that is called by the httpInclude request has now access to the X-Forwarded-For headers :)

Thank you both for working on the issue! :)
I will let the PR auto-close the issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants