Skip to content

provide a go script to forward https requests to http#16

Open
ficapy wants to merge 1 commit into
Upinel:masterfrom
ficapy:master
Open

provide a go script to forward https requests to http#16
ficapy wants to merge 1 commit into
Upinel:masterfrom
ficapy:master

Conversation

@ficapy

@ficapy ficapy commented Aug 13, 2024

Copy link
Copy Markdown

This is a very useful certificate service. I've written a small script to make it easier to use this certificate directly. The script automatically downloads the certificate to a temporary directory each time it starts, then forwards HTTPS requests to the local HTTP service. This avoids the hassle of configuring HTTPS certificates for temporary use.

@bigdcore bigdcore left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Well, I guess I'm a little lazier than you are because it took me two days to figure out that I was just bouncing off the wall

@GloriaOS GloriaOS left a comment

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.

Thanks for this PR, ficapy! This is a genuinely useful tool — auto-downloading the cert and setting up an HTTPS→HTTP proxy in one command is very clean.

I reviewed the code and have a few suggestions before merging:

🐛 Bug: Wrong download URL

The script downloads from https://aka.re/localhost but the self-signed cert bundle is at https://aka.re/localhost-ss. The current URL might 404 or return the wrong content.

💡 Suggestions

  1. Cert caching — Consider caching the downloaded cert in a temp directory (e.g. /tmp/localhost-direct/) so it doesn't re-download on every restart. Only re-download if the cached cert is older than 24h.
  2. Graceful shutdown — Add signal handling (SIGINT/SIGTERM) to clean up temp files.
  3. Default to self-signed cert — Since the public CA cert has revocation risk (#18), default to the self-signed 10-year cert bundle. The user can pass a flag for the public CA version.
  4. README placement — The usage section should go under the HTTPS/SSL section, not between the HTTP and HTTPS sections.

✅ What's great

  • Clean flag parsing with sensible defaults
  • IP validation
  • Password-protected zip extraction
  • Temp file cleanup with defer

I'd be happy to apply these fixes and merge. Want me to push the changes to this PR branch?

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