15 days ago
Hello Railway team,
A POST to my n8n service's OAuth client-registration endpoint is blocked with 403 "Access denied" before it reaches my app, while the service itself is healthy. I need this endpoint reachable so Claude (Anthropic) can register as an OAuth client for n8n's instance-level MCP server.
Service: n8n, project "invigorating-possibility", environment production, US East. Public domain: n8n-production-51add.up.railway.app. n8n Community Edition 2.37.7. Deployment is active and healthy.
What I observe (tested from a Chrome browser on the same domain):
- GET /.well-known/oauth-authorization-server returns 200 (valid JSON).
- GET /.well-known/oauth-protected-resource returns 200 (valid JSON).
- POST /mcp-server/http (no auth) returns 401 with a correct WWW-Authenticate header, so this request reaches n8n.
- POST /mcp-oauth/register (Content-Type: application/json, body {}) returns 403 with an HTML page titled "Access denied". n8n would answer with JSON, so this response does not come from my app.
- OPTIONS /mcp-oauth/register also returns 403.
- My deploy logs never show any request to /mcp-oauth/register, so it is rejected before reaching the container. The response Server header is "railway-hikari".
Impact: Claude's dynamic client registration fails with "Couldn't register with n8n's sign-in service", so I cannot connect n8n as a Claude custom connector. Discovery works; only registration fails.
Questions:
- Is there an edge rule, WAF, or bot protection on Railway's side that blocks POST /mcp-oauth/register for my domain?
- If so, can it be disabled or allowlisted for this service/path, or is there a setting on my side?
- What is the reason for the block, so I can adjust my setup?
I can share logs, timestamps, or a screen recording if useful.
Thank you,
Marco
6 Replies
15 days ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 15 days ago
15 days ago
Is Under Attack Mode enabled? (Edge section in your service settings)
15 days ago
I’d check what URL your OAuth discovery document is actually advertising for registration_endpoint.
If it’s returning something like:
http://your-domain/.../oauth/register
instead of https://..., that could explain the 405.
Railway redirects plain HTTP to HTTPS, and for POST requests that redirect can end up changing the request to GET. So the MCP client starts with a POST to the registration endpoint, Railway redirects it, and your app ultimately receives a GET on a POST-only route -> 405.
I’d check:
/.well-known/oauth-authorization-serverand look specifically at registration_endpoint.
It should be an https:// URL.
If your framework/library generates that URL from the incoming request, make sure it trusts Railway's forwarded proxy headers, or set the public/issuer/base URL explicitly to the HTTPS domain.
Then test the registration endpoint directly over HTTPS:
curl -i -X POST "https://YOUR_DOMAIN/oauth/register" \
-H "Content-Type: application/json" \
-d '{
"client_name": "test-client",
"redirect_uris": ["http://127.0.0.1/callback"]
}'If that works while the MCP client still gets a 405, I’d compare the exact registration_endpoint the client discovered against the URL above.
If the error is actually a 403 rather than a 405, I’d look at Railway's Edge/WAF settings instead, especially Under Attack Mode or any block/challenge rule on the OAuth paths.
0x5b62656e5d
Is Under Attack Mode enabled? (Edge section in your service settings)
15 days ago
Thanks for the tip! Under Attack Mode is off. But I found the cause: there is an Edge Rule on this service named "Block MCP OAuth register" (action: Block), which matches the /mcp-oauth/register path and returns the "Access denied" page. I'll review and adjust that rule and report back.
bl4ckph4ntom1
I’d check what URL your OAuth discovery document is actually advertising for `registration_endpoint`. If it’s returning something like: `http://your-domain/.../oauth/register` instead of `https://...`, that could explain the 405. Railway redirects plain HTTP to HTTPS, and for POST requests that redirect can end up changing the request to GET. So the MCP client starts with a POST to the registration endpoint, Railway redirects it, and your app ultimately receives a GET on a POST-only route -> 405. I’d check: ```text /.well-known/oauth-authorization-server ``` and look specifically at `registration_endpoint`. It should be an `https://` URL. If your framework/library generates that URL from the incoming request, make sure it trusts Railway's forwarded proxy headers, or set the public/issuer/base URL explicitly to the HTTPS domain. Then test the registration endpoint directly over HTTPS: ```bash curl -i -X POST "https://YOUR_DOMAIN/oauth/register" \ -H "Content-Type: application/json" \ -d '{ "client_name": "test-client", "redirect_uris": ["http://127.0.0.1/callback"] }' ``` If that works while the MCP client still gets a 405, I’d compare the exact `registration_endpoint` the client discovered against the URL above. If the error is actually a 403 rather than a 405, I’d look at Railway's Edge/WAF settings instead, especially Under Attack Mode or any block/challenge rule on the OAuth paths.
15 days ago
Thanks both! To close the loop: the registration_endpoint is already advertised over https, and the error is a 403 (not 405), so it is not an http-to-https redirect issue. Under Attack Mode is off. The cause is an Edge Rule on this service named "Block MCP OAuth register" (action: Block) that matches /mcp-oauth/register and returns the "Access denied" page. I'm going to review and adjust that rule and will report back here. Thank you for pointing me to the Edge settings!
mcferraz9583
Thanks both! To close the loop: the registration_endpoint is already advertised over https, and the error is a 403 (not 405), so it is not an http-to-https redirect issue. Under Attack Mode is off. The cause is an Edge Rule on this service named "Block MCP OAuth register" (action: Block) that matches /mcp-oauth/register and returns the "Access denied" page. I'm going to review and adjust that rule and will report back here. Thank you for pointing me to the Edge settings!
15 days ago
Yep, that explains the 403 then.
Since that Edge Rule is explicitly blocking /mcp-oauth/register, the request is getting stopped before it ever reaches your OAuth server.
If you still need the registration endpoint available, I'd either remove/disable that rule or add a more specific allow rule above the broader block rule, depending on what you were originally trying to protect.
After changing it I'd just retry the same MCP OAuth flow. If the POST starts reaching the app but fails after that, then the next place I'd check would be the OAuth server logs/registration validation.
Glad you found it.
15 days ago
Solved! Thanks to everyone who helped, especially the tip to check the Edge settings.
Cause: an Edge Rule on my n8n service named "Block MCP OAuth register" (When: Path matches /mcp-oauth/register*, Then: Block 403). It was returning the "Access denied" page before requests reached n8n, which is why nothing showed up in my deploy logs and why Claude's dynamic client registration failed.
Fix: I turned that rule off in Settings > Edge > Manage Rules. After that, the connector registered and connected successfully.
For anyone with a similar "couldn't register" error on a self-hosted n8n MCP server: check that the discovery documents use https URLs, then check Edge Rules / Under Attack Mode on Railway. A 403 with an HTML "Access denied" body on the register endpoint means the request is blocked at the edge, not by n8n.
Status changed to Solved 0x5b62656e5d • 15 days ago