Skip to content
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

RemoteStructServiceProvider Custom Header dose't sent to backend #6162

Open
wangyuhuiever opened this issue Dec 17, 2024 · 1 comment
Open
Labels

Comments

@wangyuhuiever
Copy link

Steps to Reproduce
This is my code

import { Editor } from 'ketcher-react';
import 'ketcher-react/dist/index/css';
import { RemoteStructServiceProvider } from 'ketcher-core';

const structServiceProvider = new RemoteStructServiceProvider(
  'http://localhost:8002' + '/api/eln/ketcher/v2',  // this my proxy url to '/api/v2'
  {
  	'X-Token': 'token',
    'custom header': 'value', // optionally you can add custom headers object 
  },
);

const MyComponent = () => {
  console.log('headers', structServiceProvider.customHeaders);
  // log headers {X-Token: 'token', custom header: 'value'}
  structServiceProvider.customHeaders = { 'X-Value': 'value' }
  // this also does't show on browser request headers
  return (
    <Editor
      staticResourcesUrl={'/'}
      structServiceProvider={structServiceProvider}
    />
  );
};

Actual behavior
In the browser Request Headers, it doesn't show any X-Token, custom header, X-Value, and backend service doesn't recevice custom headers.
Expected behavior
The Browser send custom headers to backend.

Screenshots
image

Desktop (please complete the following information):

  • OS: Ubuntu 22.04 and indigo-service in docker.
  • Browser: Chrome, edge
  • Version: 131.0.6.6778.140

Ketcher version [e.g. v2.4.2].
2.26.0 and 2.25.0

Test case
Add test case number (in EPMLSOPKET-* format) if bug was found during test case run.

Additional context
React 18.3.1

@wangyuhuiever
Copy link
Author

I notice there are some routes without custom headers. /info is don't have, but /calculate with. So, I need split unauthorizad routes and authorizad routes, then proxy with different ways?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant