Skip to content

Conversation

@adamziel
Copy link
Collaborator

@adamziel adamziel commented Oct 21, 2025

Motivation for the change, related issues

Importing WXR content with URL rewriting enabled replaces the protocol in some URLs from https to http.

Implementation details

Sets $_SERVER['HTTPS'] = "on" in the importWxr Blueprint step. The php.run() method called in the importWxr step does not set it automatically – that's a role of the request handler. The WXR importer relies on the get_site_url() WordPress function, which weirdly takes the site_url option and replaces the protocol based on the $_SERVER['https'] value.

Testing Instructions (or ideally a Blueprint)

Import this WXR file via ?importWxr query parameter and confirm all the URLs are https:

https://gist.github.com/adamziel/a3d1a1941608e068e4b3d557ee2e8202/raw/aa659a130e1104cedeea8a63155a117dcb693dc8/tt25export.xml

The tricky part is, you need to serve Playground on a https url for this to work.

cc @bph

@adamziel adamziel added [Type] Bug An existing feature does not function as intended [Feature] Import Export labels Oct 21, 2025
@adamziel adamziel merged commit 77c1d5f into trunk Oct 21, 2025
28 checks passed
@adamziel adamziel deleted the use-https-in-import-step branch October 21, 2025 10:53
adamziel added a commit that referenced this pull request Oct 21, 2025
## Motivation for the change, related issues

Importing WXR content with URL rewriting enabled replaces the protocol
in some URLs from `https` to `http`.

## Implementation details

Sets `$_SERVER['HTTPS'] = "on"` in the `importWxr` Blueprint step. The
`php.run()` method called in the `importWxr` step does not set it
automatically – that's a role of the request handler. The WXR importer
relies on the `get_site_url()` WordPress function, which weirdly takes
the `site_url` option and replaces the protocol based on the
`$_SERVER['https']` value.

## Testing Instructions (or ideally a Blueprint)

Import this WXR file via `?importWxr` query parameter and confirm all
the URLs are https:


https://gist.github.com/adamziel/a3d1a1941608e068e4b3d557ee2e8202/raw/aa659a130e1104cedeea8a63155a117dcb693dc8/tt25export.xml

The tricky part is, you need to serve Playground on a https url for this
to work.

cc @bph
@bph
Copy link
Collaborator

bph commented Oct 21, 2025

Thank you @adamziel I tested it with the content from my demo blueprint, and the bug is solved: no more opening links in new tabs.

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

Labels

[Feature] Import Export [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants