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

Fix --base-url improper path and protocol handling using zola serve #2311

Merged
merged 2 commits into from
Mar 1, 2024

Conversation

jamwil
Copy link
Contributor

@jamwil jamwil commented Sep 18, 2023

Correctly parse the protocol and path from the base url, and differentiate between the bound interface and the base URL when using zola serve.

Closes #2170.

Sanity check:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code changes

(Delete or ignore this section for documentation changes)

  • Are you doing the PR on the next branch?

If the change is a new feature or adding to/changing an existing one:

  • Have you created/updated the relevant documentation page(s)?

@jamwil jamwil marked this pull request as ready for review November 9, 2023 23:50
@jamwil
Copy link
Contributor Author

jamwil commented Nov 9, 2023

I'm marking this as Ready for Review.

The discussion in #2170 can be split into two separate features—the first being to properly parse the base_url so that zola serve works at various endpoints, including https endpoints. I believe this PR handles that use case without any changes to existing documentation.

The second feature requested in #2170 is to allow arbitrary paths while serving the content from a static /public directory (or wherever it is configured). This ventures into url_rewriting territory and, as far as I can tell, would require patching the make_service block in serve.rs.

I'm going to open this up to Allow edits by maintainers if anyone wants to delve further into it, and I'm open to guidance from someone that understands the codebase better than I do, but I think this is a suitable patch to tackle part of the issue as is.

See additional comment.

@jamwil
Copy link
Contributor Author

jamwil commented Nov 10, 2023

I worked through the mounting problem. We should be able to serve at any arbitrary endpoint, including subpaths. This should close #2170.

@jamwil jamwil marked this pull request as draft January 17, 2024 16:43
@jamwil
Copy link
Contributor Author

jamwil commented Jan 17, 2024

Looks like the changes I made to support paths introduced a regression for the https change. I'm investigating.

@jamwil jamwil marked this pull request as ready for review February 11, 2024 18:32
@jamwil
Copy link
Contributor Author

jamwil commented Feb 11, 2024

Fixed the regression here. This should work as stated on the tin.

@Keats
Copy link
Collaborator

Keats commented Feb 12, 2024

Can you cherry pick the commits on a rebased next branch?

@jamwil
Copy link
Contributor Author

jamwil commented Feb 12, 2024

Can you cherry pick the commits on a rebased next branch?

Yep, working on it. Some signatures have changed so it's a bit of an involved merge.

@jamwil
Copy link
Contributor Author

jamwil commented Feb 20, 2024

@clarfonthey This PR has a lot of overlap with the work you did in January. Just wanted to give you a heads up so you can verify that it doesn't introduce any regressions to your work. It was a bit of a delicate merge.

@clarfonthey
Copy link
Contributor

Thanks for the heads up @jamwil; any work I haven't merged is probably going to be redone anyway, so, I'm not worried about conflicts.

@jamwil
Copy link
Contributor Author

jamwil commented Feb 28, 2024

@Keats Is there anything outstanding that we need to address?

src/cmd/serve.rs Show resolved Hide resolved
src/cmd/serve.rs Show resolved Hide resolved
@Keats Keats merged commit 4bf67af into getzola:next Mar 1, 2024
5 checks passed
@jamwil jamwil deleted the fix-2170 branch March 1, 2024 15:25
veluca93 pushed a commit to veluca93/zola that referenced this pull request May 14, 2024
…getzola#2311)

* Fix --base-url improper path and protocol handling.

* Fix formatting.
Keats pushed a commit that referenced this pull request Jun 20, 2024
…#2311)

* Fix --base-url improper path and protocol handling.

* Fix formatting.
berdandy pushed a commit to berdandy/azola that referenced this pull request Sep 17, 2024
…getzola#2311)

* Fix --base-url improper path and protocol handling.

* Fix formatting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants