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

How to configure path of certificate files relative to the http file #1238

Open
meakgoz opened this issue Jan 19, 2024 · 3 comments
Open

How to configure path of certificate files relative to the http file #1238

meakgoz opened this issue Jan 19, 2024 · 3 comments

Comments

@meakgoz
Copy link

meakgoz commented Jan 19, 2024

Hi Huachao and the community,

I managed to get the JWT token with certificate.
It is working when I give the full path, or relative to the workspace root.

I have the http file in here: /Users/<myUserId>/git/<projectName>/backend/test/manual-requests/requests.http
and certificate in here: /Users/<myUserId>/git/<projectName>/backend/test/manual-requests/cert.pem
and key: /Users/<myUserId>/git/<projectName>/backend/test/manual-requests/key.pem

Then, this configuration works:

  "rest-client.certificates": {
    "mydomain.com": {
      "cert": "/Users/<myUserId>/git/<projectName>/backend/test/manual-requests/cert.pem",
      "key": "/Users/<myUserId>/git/<projectName>/backend/test/manual-requests/key.pem"
    }
  },

Or this one also works:

  "rest-client.certificates": {
    "mydomain.com": {
      "cert": "./backend/test/manual-requests/cert.pem",
      "key": "./backend/test/manual-requests/key.pem"
    }
  }

However, I get error when I try the path relative to the http file:

  "rest-client.certificates": {
    "mydomain.com": {
      "cert": "./cert.pem",
      "key": "./key.pem"
    }
  }

I get the following error: Certificate path ./key.pem doesn't exist, please make sure it exists.

How can I configure path of certificate files relative to the http file?

@rufreakde
Copy link

"./backend/test/manual-requests/key.pem" -> "backend/test/manual-requests/key.pem" worked for me.

PS: I switched to the p12 certificate structure as it was simpler to use and maintain. And here I am not sure how to maintain the passphrase in ENV.

@meakgoz
Copy link
Author

meakgoz commented Jan 31, 2024

Hi @rufreakde, thank you for your answer.
Unfortunately, following your suggestion did not do the trick for me.
In fact, this "./backend/test/manual-requests/key.pem" is working for me, and this path is actually relative to the workspace.
The problem is, "cert": "./cert.pem" or "cert": "cert.pem" does not work, where this is relative to the test.http file.
In the documentation it states:

you need to set the certificates paths(absolute/relative to workspace/relative to current http file)

but could not make this work for me.

@cplussharp
Copy link

Some years ago a created this pull request #808 to allow TLS client certificates per request. Sadly it was never merged.

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

No branches or pull requests

3 participants