ChatGPT cannot complete the OAuth connection to DevSpace when DevSpace is exposed through a Cloudflare Named Tunnel with a custom domain.
The OAuth owner approval succeeds and DevSpace returns HTTP 302, but ChatGPT does not continue to the /token request. The connector remains disconnected.
A Cloudflare Quick Tunnel previously worked with the same local DevSpace service.
Environment
- DevSpace version: 1.0.4
- Operating system: Windows 11
- MCP local endpoint:
http://127.0.0.1:7676/mcp
- Public endpoint:
https://mcp.example.xyz/mcp
- Reverse proxy: Cloudflare Named Tunnel
- ChatGPT account: Plus
- Browser: Chrome
Configuration
publicBaseUrl is configured as the public origin without /mcp:
{
"host": "127.0.0.1",
"port": 7676,
"allowedRoots": [
"F:\\path\\to\\projects"
],
"publicBaseUrl": "https://mcp.example.xyz"
}
The public MCP URL configured in ChatGPT is:
https://mcp.example.xyz/mcp
The custom hostname is included in the DevSpace allowed hosts.
What Works
The following checks succeed:
-
https://mcp.example.xyz/mcp returns 401 Missing Authorization header.
-
/.well-known/oauth-protected-resource/mcp works.
-
/.well-known/oauth-authorization-server works.
-
The OAuth metadata exposes:
authorization_endpoint
token_endpoint
registration_endpoint
-
A manual POST /register request returns 201 Created.
-
The returned Client ID is configured in ChatGPT as a custom OAuth client.
-
The registered redirect URI exactly matches the callback URL shown by ChatGPT.
-
The DevSpace owner approval page opens correctly.
-
The owner password is accepted.
-
DevSpace logs show the authorization form submission returning HTTP 302.
Actual Behavior
After clicking Authorize DevSpace:
- The authorization window closes or redirects back to ChatGPT.
- The ChatGPT connector remains disconnected.
- ChatGPT reports a connection error.
- DevSpace logs do not show a subsequent
POST /token request.
Relevant log flow:
GET /authorize ... 200
POST / ... 302
The expected next request never appears:
Reverse Proxy Issue
Before this, DevSpace produced the following error:
ERR_ERL_UNEXPECTED_X_FORWARDED_FOR
The 'X-Forwarded-For' header is set but Express 'trust proxy' is false
I temporarily fixed this locally by changing the DevSpace server code to:
app.set("trust proxy", 1);
After this change, the forwarded-header error disappeared, but the OAuth callback and token exchange problem remained.
This suggests DevSpace may need first-class reverse proxy support or a configurable trustProxy option.
Expected Behavior
After owner approval:
- DevSpace redirects to the registered ChatGPT callback URL.
- ChatGPT exchanges the authorization code at
/token.
- The connector becomes connected.
- ChatGPT can discover and call the DevSpace MCP tools.
Comparison
The same local DevSpace setup previously worked through a Cloudflare Quick Tunnel using a temporary trycloudflare.com hostname.
The failure occurs when using:
- Cloudflare Named Tunnel
- A custom fixed domain
- A fresh OAuth client registration and authorization
Reproduction Steps
- Configure DevSpace with a custom public base URL.
- Expose port 7676 through a Cloudflare Named Tunnel.
- Configure the public hostname to forward to
http://127.0.0.1:7676.
- Add the custom hostname to the DevSpace allowed hosts.
- Create a ChatGPT custom MCP connector using OAuth.
- Register the ChatGPT callback URL through
POST /register.
- Enter the generated Client ID in ChatGPT.
- Start the connection.
- Enter the DevSpace owner password.
- Observe that DevSpace returns HTTP 302, but ChatGPT never calls
/token.
Questions
-
Is Cloudflare Named Tunnel with a custom domain currently supported?
-
Does DevSpace require additional reverse proxy settings besides publicBaseUrl and allowed hosts?
-
Should Express trust proxy be enabled automatically or made configurable?
-
Is there a known issue with ChatGPT callback URLs or the /token exchange?
-
Can DevSpace add debug logging for:
- The final OAuth redirect URL
- Redirect URI validation
- Authorization code generation
- Token endpoint requests
- OAuth validation failures
Please let me know which additional logs or diagnostics would be useful.
ChatGPT cannot complete the OAuth connection to DevSpace when DevSpace is exposed through a Cloudflare Named Tunnel with a custom domain.
The OAuth owner approval succeeds and DevSpace returns HTTP 302, but ChatGPT does not continue to the
/tokenrequest. The connector remains disconnected.A Cloudflare Quick Tunnel previously worked with the same local DevSpace service.
Environment
http://127.0.0.1:7676/mcphttps://mcp.example.xyz/mcpConfiguration
publicBaseUrlis configured as the public origin without/mcp:{ "host": "127.0.0.1", "port": 7676, "allowedRoots": [ "F:\\path\\to\\projects" ], "publicBaseUrl": "https://mcp.example.xyz" }The public MCP URL configured in ChatGPT is:
The custom hostname is included in the DevSpace allowed hosts.
What Works
The following checks succeed:
https://mcp.example.xyz/mcpreturns401 Missing Authorization header./.well-known/oauth-protected-resource/mcpworks./.well-known/oauth-authorization-serverworks.The OAuth metadata exposes:
authorization_endpointtoken_endpointregistration_endpointA manual
POST /registerrequest returns201 Created.The returned Client ID is configured in ChatGPT as a custom OAuth client.
The registered redirect URI exactly matches the callback URL shown by ChatGPT.
The DevSpace owner approval page opens correctly.
The owner password is accepted.
DevSpace logs show the authorization form submission returning HTTP 302.
Actual Behavior
After clicking Authorize DevSpace:
POST /tokenrequest.Relevant log flow:
The expected next request never appears:
Reverse Proxy Issue
Before this, DevSpace produced the following error:
I temporarily fixed this locally by changing the DevSpace server code to:
After this change, the forwarded-header error disappeared, but the OAuth callback and token exchange problem remained.
This suggests DevSpace may need first-class reverse proxy support or a configurable
trustProxyoption.Expected Behavior
After owner approval:
/token.Comparison
The same local DevSpace setup previously worked through a Cloudflare Quick Tunnel using a temporary
trycloudflare.comhostname.The failure occurs when using:
Reproduction Steps
http://127.0.0.1:7676.POST /register./token.Questions
Is Cloudflare Named Tunnel with a custom domain currently supported?
Does DevSpace require additional reverse proxy settings besides
publicBaseUrland allowed hosts?Should Express
trust proxybe enabled automatically or made configurable?Is there a known issue with ChatGPT callback URLs or the
/tokenexchange?Can DevSpace add debug logging for:
Please let me know which additional logs or diagnostics would be useful.