2

I'm trying to modify domain for which the cookie is valid with mod_headers:

From: ipa_session=e88331a44e20d8b5caaacb0e896029fe; Domain=internal.example.com; Path=/ipa; Expires=Tue, 13 Dec 2016 09:31:33 GMT; Secure; HttpOnly

To:ipa_session=e88331a44e20d8b5caaacb0e896029fe; Domain=example.com; Path=/ipa; Expires=Tue, 13 Dec 2016 09:31:33 GMT; Secure; HttpOnly

Mod-headers is working well, these rules work:

Header set "something" "something"
Header edit "something" "something" "somethingdifferent"

But editing "Set-Cookie" header just does nothing:

Header edit "Set-Cookie" "Domain=internal.example.com" "Domain=example.com"

Apache syntax is OK, but the rule just does nothing.

Apache package version: 2.4.18-2ubuntu3.1

Misko
  • 1,542
  • 2
  • 19
  • 31

2 Answers2

5

Adding to Misko's response (because my account is too new to comment) the Apache docs say that the response headers come out of TWO sets of internal tables. Thus "always" is required for some things to work, and an absence of "always" is required for others to work. In my case, Ubuntu 18.04, Apache 2.4.29 I had to remove "always" for the headers to be edited coming out of PHP 7.2.

The docs seem to suggest you can have both directives to cover all bases but I have not tested that.

eburnside
  • 117
  • 1
  • 2
4

One has to add always before edit

Header always edit "Set-Cookie" "Domain=internal.example.com" "Domain=example.com"

For my instance, I used edit* as well (replaces all occurrences)

Misko
  • 1,542
  • 2
  • 19
  • 31