shridhar-tl / jira-assistant

Repository containing source code of Jira Assistant browser extension. This is also used to track bugs related to the extension.
https://www.jiraassistant.com
235 stars 74 forks source link

CORS Preflight did not succeed on custom Jira server #352

Closed bergerst closed 4 months ago

bergerst commented 4 months ago

Checklist before you being

How do you use Jira Assistant?

Browser extension

Are you using cloud version of Jira or self hosted (data center / server) of Jira.

Self hosted (datacenter)

Version of Jira Assistant

v2.58

What browser are you using?

Firefox

What OS are you using? You need not disclose this if you feel it is irr-relevant for your issue.

Windows

Bug Description

I am trying to set up Jira Assistant for my company's Jira server and getting this error in the network logs.

image

Previously I faced another CORS error until I added moz-extension://5bb4c444-5db8-4384-a9b4-6fa21bd381e3 to the server's CORS Allowlist.

Here are the failing request and response:

OPTIONS /rest/api/2/myself HTTP/1.1
Host: jira.xxx.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Access-Control-Request-Method: GET
Access-Control-Request-Headers: content-type,user-agent
Origin: moz-extension://5bb4c444-5db8-4384-a9b4-6fa21bd381e3
Connection: keep-alive
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site
HTTP/1.1 401 
Server: nginx/1.14.1
Date: Fri, 01 Mar 2024 12:53:09 GMT
Content-Type: application/xml;charset=UTF-8
Content-Length: 148
Connection: keep-alive
X-AREQUESTID: 833x1439853x1
Referrer-Policy: strict-origin-when-cross-origin
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: sandbox
Strict-Transport-Security: max-age=31536000
Set-Cookie: atlassian.xsrf.token=B1PI-S9BJ-TZKJ-5N13_da9fa7d85a92217a10324b940fd3186b74a64109_lout; Path=/; Secure; SameSite=None
X-AUSERNAME: anonymous
Cache-Control: no-transform
Access-Control-Allow-Origin: moz-extension://5bb4c444-5db8-4384-a9b4-6fa21bd381e3
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: Origin, Authorization, Content-Type
Vary: User-Agent
WWW-Authenticate: OAuth realm="https%3A%2F%2Fxxx.com"
Content-Encoding: gzip

Chrome and Edge work on my machine.

Checklist before you submit

bergerst commented 4 months ago

Was able to resolve the issue by enabling these options in about:addons -> Jira Assistant -> Permissions

image