Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

'authorization' is missing in Access-Control-Allow-Headers only in a specific request #2093

Closed
mtlive opened this issue Jun 11, 2024 · 4 comments
Labels
waiting Waiting for answer to question or feedback from issue raiser Websockets Ocelot feature: Websockets

Comments

@mtlive
Copy link

mtlive commented Jun 11, 2024

We tried to use Ocelot for our gateway, but our signalR requests (in http) ended up in Error 401 Unauthorized. I looked up the network requests and noticed that 'authorization' is missing in Access-Control-Allow-Headers:
image

This problem doesn't exist when connected directly or for other requests in other paths.
I even tried to create a separate route for this pass but the issue still remains.

Expected Behavior

authorization should be included in Access-Control-Allow-Headers in OPTIONS request method
image

Actual Behavior

It's missing

Specifications

  • Version: 23.3.0
  • Platform: .NET 8 (Windows)
  • Subsystem:
@raman-m raman-m added the Websockets Ocelot feature: Websockets label Jun 12, 2024
@raman-m
Copy link
Member

raman-m commented Jun 12, 2024

Hello @mtlive !
Welcome to Ocelot world! 🐯

Indeed, authentication and authorization have not been implemented in Ocelot for the Websockets feature. There's an ongoing issue, #1040, which is currently in progress. However, it's unclear when it will be resolved as there are no open PRs at the moment.

I will mark our issue as a duplicate of #1040. At least we have implement both tickets #1040 and #2093 in one PR.
Let me know if this issue is about another dev case.


This problem doesn't exist when connected directly or for other requests in other paths.
I even tried to create a separate route for this pass but the issue still remains.

When you said "directly" did you try without Ocelot or with Ocelot?
Did you test anonymous route definition?
I mean if you want Authorization by Ocelot and it is not implemented, then you have to redefine to route anonym traffic only.

Show us your ocelot.json plz!

Ideally, better to upload your solution to GitHub as a repo.

@raman-m raman-m added the waiting Waiting for answer to question or feedback from issue raiser label Jun 12, 2024
@mtlive
Copy link
Author

mtlive commented Jun 15, 2024

Indeed, authentication and authorization have not been implemented in Ocelot for the Websockets feature.

I don't do authentication at Ocelot, it'll be done at the service. Furthermore, this request isn't in WebSocket.

When you said "directly" did you try without Ocelot or with Ocelot?

By directly I mean without Ocelot.
My configuratin:

  "Routes": [
    {
      "DownstreamPathTemplate": "/api/{everything}",
      "DownstreamScheme": "http",
      "SwaggerKey": "officeautomation",
      "DownstreamHostAndPorts": [
        {
          "Host": "192.168.10.209",
          "Port": 5001
        }
      ],
      "UpstreamPathTemplate": "/officeautomation/api/{everything}"  
    }
  ]
}

@raman-m
Copy link
Member

raman-m commented Jun 17, 2024

Okay, it appears I've identified the issue. However, I need to examine your C# configuration code.

🙏 Provide your Ocelot setup and configuration C# code, specifically the program.cs file❗

My current understanding of your problem is missing CORS setup in Ocelot web app.

Finally I'd say you need this setup to enable OPTIONS via CORS:

@raman-m
Copy link
Member

raman-m commented Jun 17, 2024

Apologies, this isn't an actual issue but rather a misconfiguration. I will convert this to a discussion...

@ThreeMammals ThreeMammals locked and limited conversation to collaborators Jun 17, 2024
@raman-m raman-m converted this issue into discussion #2106 Jun 17, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
waiting Waiting for answer to question or feedback from issue raiser Websockets Ocelot feature: Websockets
Projects
None yet
Development

No branches or pull requests

2 participants