Карма-прокси не go на правильный порт при исходящих запросах - PullRequest
0 голосов
/ 23 апреля 2020

Использование тестов кармы, которые начинаются с порта 9876; и настроил прокси, вот так; что означает путь перенаправления / Person (из 9876) на порт 8180 с использованием того же пути.

proxies: { "/Person": "http://localhost:8180"},

Просмотр Chrome Инструменты разработчика Вкладка "Сеть":

URL: http://localhost:9876/Person  <-The correct path of /Person
Request Method: GET  <-The correct method
Status Code: 200 OK
Remote Address: 127.0.0.1:9876
Referrer Policy: no-referrer-when-downgrade
connection: close
content-length: 362
content-type: application/json; charset=utf-8
date: Thu, 23 Apr 2020 16:24:40 GMT
msl-api-process-time: 16
server: Microsoft-IIS/10.0
x-powered-by: ASP.NET
x-sourcefiles: =?UTF-8?B?RDpcU291cmNlXE1OTG90dGVyeVxHYXZpYVxHYXZpYVxXZWJcQXBp?=
Accept: application/json, text/plain, */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
Cookie: io=W9vbga6C3CIdeUVlAAAB
Host: localhost:9876
Referer: http://localhost:9876/context.html
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors  <- The correct mode
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36

Глядя на трассу от Wireshark:

GET /Person HTTP/1.1  <- this is correct form of get request, with the path for Person
Host: localhost:9876  <- this is the proper originator
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate  <- this is suspect because the mode is not CORS, but may be the magic of CORS in Action
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cookie: io=C3qm59rTbc8szCITAAAB

HTTP/1.1 200 OK
content-length: 362
content-type: application/json; charset=utf-8
server: Microsoft-IIS/10.0
msl-api-process-time: 8
x-sourcefiles: =?UTF-8?B?RDpcU291cmNlXE1OTG90dGVyeVxHYXZpYVxHYXZpYVxXZWJcQXBp?=
x-powered-by: ASP.NET
date: Thu, 23 Apr 2020 15:32:45 GMT
connection: close

// This is the wrong returned data.
// It is the data from the root as if the request was http:localhost:9876, as if the Person part never made it inbound.

[{"environment":"Local","endpoints":null,"processorCores":12,"timingPerSecond":{"timerID":0,"counter":0,"allTime":{"total":14,"peak":5,"average":0.0045},"lastSecond":{"total":0,"peak":0,"average":0.0},"lastMinute":{"total":0,"peak":0,"average":0.0},"lastHour":{"total":14,"peak":5,"average":0.0045},"lastDay":{"total":14,"peak":5,"average":0.0045},"name":null}}]

Тогда возникает вопрос: почему исходящий запрос с правильным путем завершается запросом http://localhost: 9876 без пути? Это достигает конечной точки root, которая обслуживает непредвиденные данные.

Что я обнаружил? Я писал о том, как работает прокси-карма здесь

Все предложения приветствуются.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...