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

Forward cookies from request #1804

Merged
merged 6 commits into from
Sep 8, 2023
Merged

Forward cookies from request #1804

merged 6 commits into from
Sep 8, 2023

Conversation

j-waters
Copy link
Contributor

@j-waters j-waters commented Aug 11, 2023

Proposed change

Take any cookies that are present on the request to endpoints such as api/ping and api/services and add them to the cookie jar. This means that services that are behind authentication such as authelia can be pinged and used in widgets.

The way this is done probably isn't overly correct - but it works for my usage. I thought I'd make an MR anyway to see if there was any interest in this feature.

Closes #1797

Type of change

  • New service widget
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Other (please explain)

Checklist:

  • If adding a service widget or a change that requires it, I have added a corresponding PR to the documentation here:
  • If adding a new widget I have reviewed the guidelines.
  • If applicable, I have checked that all tests pass with e.g. pnpm lint.
  • If applicable, I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.

@j-waters j-waters changed the title Forward cookies from request Draft: Forward cookies from request Aug 11, 2023
Copy link
Collaborator

@shamoon shamoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain a bit more about how youre using this specifically? When are the authelia headers getting set initially?

src/utils/proxy/cookie-jar.js Show resolved Hide resolved
src/utils/proxy/cookie-jar.js Outdated Show resolved Hide resolved
@j-waters
Copy link
Contributor Author

j-waters commented Aug 11, 2023

Can you explain a bit more about how youre using this specifically? When are the authelia headers getting set initially?

So I have a bunch of services on a subdomain, all behind authelia. Requests made to homepage.domain.com have an authelia_session=<TOKEN> cookie set. That same cookie is consumed by other services on the same domain.

The idea here is that when a request comes in to homepage, we take the cookies from the cookie header, add them to the cookie jar, and then they can be used in requests to the actual services.

@shamoon shamoon marked this pull request as draft August 11, 2023 22:31
@shamoon
Copy link
Collaborator

shamoon commented Aug 26, 2023

I still havent tested this out much, but it looks OK to me. Any reason its still a draft?

@shamoon
Copy link
Collaborator

shamoon commented Sep 8, 2023

@j-waters if youre still interested in this let us know, otherwise we'll close it out

@j-waters j-waters changed the title Draft: Forward cookies from request Forward cookies from request Sep 8, 2023
@j-waters j-waters marked this pull request as ready for review September 8, 2023 22:20
@j-waters
Copy link
Contributor Author

j-waters commented Sep 8, 2023

Sorry yeah I'm still interested, been using this branch in my home setup for about a month now and haven't found any issues

@shamoon shamoon merged commit d4edd43 into gethomepage:main Sep 8, 2023
1 check passed
@shamoon
Copy link
Collaborator

shamoon commented Sep 8, 2023

I'd like to add this to the docs somewhere, not sure where. Hmm...

shamoon added a commit that referenced this pull request Sep 9, 2023
shamoon added a commit that referenced this pull request Sep 9, 2023
Copy link
Contributor

github-actions bot commented Feb 5, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants