Skip to content

[WIP] 希望支持微信云托管 #3657

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

Closed
wants to merge 1 commit into from
Closed

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 24, 2025

Add support for WeChat Cloud hosting by allowing HTTP instead of HTTPS for API calls

Problem:
When using WeChat Cloud hosting (微信云托管), WeChat resolves api.weixin.qq.com to an internal network address that doesn't support HTTPS. Users need a configuration option to force HTTP usage in these scenarios.

Analysis:

  • Currently, only weixin-java-channel and weixin-java-miniapp modules have API host URL replacement support
  • Other modules (mp, cp, open, pay, qidian) don't have this feature
  • Need to add consistent support across all modules for WeChat cloud hosting

Implementation Plan:

  • Analyze current codebase and identify modules that need updates
  • Add isUseHttpOnly()/setUseHttpOnly() configuration option to channel and miniapp modules
  • Update all base service implementations to respect this configuration
  • Implement URL replacement logic to switch from HTTPS to HTTP when enabled
  • Test the changes in channel and miniapp modules
  • Add full API host URL and HTTP-only support to other modules
  • Update configuration implementations to support the new option

Changes Made:

  • Added useHttpOnly configuration option to WxChannelConfig and WxMaConfig interfaces
  • Updated default configuration implementations to support the new option
  • Modified base service implementations to replace https://api.weixin.qq.com with http://api.weixin.qq.com when useHttpOnly is true
  • Updated all HTTP client implementations (OkHttp, Apache HttpClient, etc.) to handle the HTTP-only mode

Modules Updated:

  • weixin-java-channel (now supports HTTP-only mode)
  • weixin-java-miniapp (now supports HTTP-only mode)
  • weixin-java-mp (needs full API host URL and HTTP-only support)
  • weixin-java-cp (needs full API host URL and HTTP-only support)
  • weixin-java-open (needs full API host URL and HTTP-only support)
  • weixin-java-pay (needs full API host URL and HTTP-only support)
  • weixin-java-qidian (needs full API host URL and HTTP-only support)

Usage:

// For WeChat cloud hosting environments
WxChannelDefaultConfigImpl config = new WxChannelDefaultConfigImpl();
config.setUseHttpOnly(true); // Forces HTTP instead of HTTPS

Fixes #3570.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

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.

希望支持微信云托管
2 participants