Skip to content

Patch: drop R=301 flag on RewriteRule#201

Open
colisee wants to merge 1 commit intoLibreBooking:masterfrom
colisee:issues/200
Open

Patch: drop R=301 flag on RewriteRule#201
colisee wants to merge 1 commit intoLibreBooking:masterfrom
colisee:issues/200

Conversation

@colisee
Copy link
Copy Markdown
Collaborator

@colisee colisee commented Apr 25, 2026

Related to librebooking/librebooking PR 1358

Patch added to script entrypoint.sh to backport the fix to existing releases (v4.3.0, v4.2.0,...)
Close issue #200

@colisee colisee added the Patch Patch an issue that should be fixed in upstream or to backport a fix to previous releases label Apr 25, 2026
@colisee
Copy link
Copy Markdown
Collaborator Author

colisee commented Apr 25, 2026

To test:

  1. Copy file examples/docker/docker-compose-internet.yml from repo colisee/librebooking-docker inside branch barakiva and remove the services acme and cron
  2. Add a line 127.0.0.1 localhost acme.org inside your hosts file
  3. Run docker compose up --detach or equivalent
  4. From your web browser, access http://acme.org and or http://acme.org/install

@JohnVillalovos JohnVillalovos requested a review from Copilot April 25, 2026 14:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JohnVillalovos
Copy link
Copy Markdown
Collaborator

JohnVillalovos commented Apr 25, 2026

As a note I don't think the upstream patch is correct. As it removes the redirect. I'm not 100% sure it isn't correct but I am leaning that way.

UPDATE 2026-04-26: I'm now less confident about it being incorrect. But I'm also not sure it is the correct way to fix it. Leaning somewhat towards merging it, but worried it might break something we aren't considering.

@colisee
Copy link
Copy Markdown
Collaborator Author

colisee commented Apr 25, 2026

Copilot wasn't able to review any files in this pull request.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This is odd, for the patch code was added around line 106...

@colisee
Copy link
Copy Markdown
Collaborator Author

colisee commented Apr 25, 2026

As a note I don't think the upstream patch is correct. As it removes the redirect. I'm not 100% sure it isn't correct but I am leaning that way.

The patch removes the redirect flag R=301 but the URL gets rewritten through the RewriteRule statement and the web browser follows the new URL. You can test:

  1. Clone my forked repo and switch to branch issues/200
  2. cd <cloned_directory_path>
  3. docker image build --tag librebooking/librebooking:develop .
  4. cd .examples/docker
  5. docker compose up --file docker-compose-local.yml up --detach
  6. Browse the URL http://localhost:8080 or http://localhost:8080/install

Comment thread bin/entrypoint.sh
# Patch the /web rewrite
sed \
-i /var/www/html/.htaccess \
-e '/^RewriteRule/s:\[R=301,L\]:\[L\]:'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This would be enough sed '/^RewriteRule/s:R=301,::' to remove redirect. In the substitution the \ -marks are not needed anyhow in \[

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If you want to keep it longer for readability, go ahead, but I'd still remove the backslashes from substitution part.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This sort of breaks the fix that was done on line 132 below. For being idempotent.

Comment thread bin/entrypoint.sh
# Patch the /web rewrite
sed \
-i /var/www/html/.htaccess \
-e '/^RewriteRule/s:\[R=301,L\]:\[L\]:'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This sort of breaks the fix that was done on line 132 below. For being idempotent.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Patch Patch an issue that should be fixed in upstream or to backport a fix to previous releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants