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

URL path construction is not working if root is of form localhost:port #125

Open
b4l opened this issue Oct 1, 2020 · 23 comments
Open

URL path construction is not working if root is of form localhost:port #125

b4l opened this issue Oct 1, 2020 · 23 comments
Assignees

Comments

@b4l
Copy link

b4l commented Oct 1, 2020

When having a root of the form http://localhost:XXXX the conformance test request resolves to http://localhost:XXXX/%2F%2Fconformance.

@dstenger
Copy link
Contributor

dstenger commented Oct 1, 2020

Thank you for reporting.

@keshav-nangare Can you please analyse the reported issue?

@dstenger
Copy link
Contributor

dstenger commented Oct 7, 2020

@b4l So, the error occurs when the landing page is located at http://localhost:XXXX without using a context path?

@b4l
Copy link
Author

b4l commented Oct 7, 2020

yes

@keshavnangare
Copy link

I tried to configure the root path as localhost:port of local GeoServer using proxy but the first request is sent using that whereas other all requests are sent similarly as per the local Geoserver deployment.

@keshavnangare
Copy link

Following is my workaround:

  1. I am able to configure the server such that http://localhost:8081/geoserver/ogc/features/(Base_path) is accessed using the http://localhost:8082 endpoint.
  2. I checked further requests are sent as {Base_path}/api or {Base_path}/conformance because these links are fetched from the {Base_path} endpoint as per implementation.

@dstenger
Copy link
Contributor

dstenger commented Jan 20, 2021

We noticed that %2F refers to a '/'. We therefore suspect that it might be a problem with the API definition document.

@b4l Is it possible that you provide the OpenAPI document which is causing the error?

@b4l
Copy link
Author

b4l commented Jan 20, 2021

@dstenger here is the yaml api doc as text file: ogcapi-features-1.txt

@keshavnangare
Copy link

@dstenger

I went through this document and it looks good. Maybe we can discuss it in the next meeting.

@ghobona
Copy link
Contributor

ghobona commented Feb 11, 2021

2021-02-11

@keshav-nangare to try reproducing the issue through a GWT Proxy modification.

lgoltz added a commit that referenced this issue Jul 27, 2021
@lgoltz
Copy link
Contributor

lgoltz commented Jul 27, 2021

I've added a test, but cannot reproduced the problem.
@b4l Can you provide the OpenAPI document of the server?

@dstenger dstenger assigned b4l and unassigned dstenger and lgoltz Jul 27, 2021
@b4l
Copy link
Author

b4l commented Jul 27, 2021

@lgoltz please find it here: #125 (comment)

@lgoltz
Copy link
Contributor

lgoltz commented Jul 28, 2021

Sorry, I've overlooked this comment.
But I'm still not able to reproduce the problem. I've setup a mock service with SoapUI and three resources:

  • / (LandingPage)
  • /api (Returning the provided OpenAPI document)
  • /conformance (Conformance classes)
    The OpenAPI document was converted to json and the server url set to http://localhost:8080.

The test validateConformanceOperationAndResponse (in org.opengis.cite.ogcapifeatures10.conformance.core.conformance.Conformance) is passed.

@b4l Can you provide some more information about the failing test?

@b4l
Copy link
Author

b4l commented Aug 2, 2021

Somehow used service-doc instead of service-desc link relation for the api document on the landing page. Fixing this resolves the issue.
Sorry for this and thanks a lot for your effort!

@b4l b4l closed this as completed Aug 2, 2021
@NicolaiLolansen
Copy link

NicolaiLolansen commented Nov 22, 2021

Sorry, but i think this still might be an issue.

Running my test-suite i get this:

stac-fastapi-sqlalchemy  | INFO:     172.18.0.1:41672 - "GET /api HTTP/1.1" 200 OK
ogc-teamengine           | Request method:      GET
ogc-teamengine           | Request URI: http://192.168.208.1:8081/%2F%2Fconformance
ogc-teamengine           | Proxy:                       <none>
ogc-teamengine           | Request params:      <none>
ogc-teamengine           | Query params:        <none>
ogc-teamengine           | Form params: <none>
ogc-teamengine           | Path params: <none>
ogc-teamengine           | Headers:             Accept=application/json, application/javascript, text/javascript, text/json
stac-fastapi-sqlalchemy  | INFO:     172.18.0.1:41678 - "GET ///conformance HTTP/1.1" 404 Not Found
ogc-teamengine           | Cookies:             <none>
ogc-teamengine           | Multiparts:          <none>
ogc-teamengine           | Body:                        <none>

Here you can clearly see the call to ///conformance which is not right. I have no idea where the extra forward slashes comes from

Test is run using Docker

Conformance link at root / looks like this:

{
      "rel": "conformance",
      "type": "application/json",
      "title": "STAC/WFS3 conformance classes implemented by this server",
      "href": "http://192.168.208.1:8081/conformance"
},

@dstenger dstenger reopened this Nov 23, 2021
@dstenger
Copy link
Contributor

Thank you for reporting. We will do further investigation.

Can you please provide the OpenAPI document of your service and the complete response of the landing page?
Both is important for the test.

@dstenger dstenger assigned bpross-52n and unassigned b4l Nov 23, 2021
@NicolaiLolansen
Copy link

Sorry for the delay,

I have a test service running here: https://skraafotodistribution-stac-api-sandbox.k8s-test-121.septima.dk/

And for duplication:
Landing page:

{
	"type": "Catalog",
	"id": "dataforsyningen-flyfotoapi",
	"title": "Dataforsyningen FlyfotoAPI",
	"description": "API til udstilling af metadata for ikke-oprettede flyfotos.",
	"stac_version": "1.0.0",
	"conformsTo": ["http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/oas30", "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:queryable-second-operand", "http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/geojson", "https://api.stacspec.org/v1.0.0-beta.3/ogcapi-features", "https://api.stacspec.org/v1.0.0-beta.3/core", "https://api.stacspec.org/v1.0.0-beta.3/item-search/#context", "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:arithmetic", "http://www.opengis.net/spec/ogcapi-features-2/1.0/conf/crs", "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:enhanced-temporal-operators", "https://api.stacspec.org/v1.0.0-beta.3/item-search/#sort", "https://api.stacspec.org/v1.0.0-beta.3/item-search/#fields", "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:cql-json", "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:basic-cql", "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:item-search-filter", "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:filter", "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:basic-spatial-operators", "https://api.stacspec.org/v1.0.0-beta.3/item-search", "http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/core", "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:enhanced-spatial-operators", "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:enhanced-comparison-operators", "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:arrays"],
	"links": [{
		"rel": "self",
		"type": "application/json",
		"href": "https://skraafotodistribution-stac-api-sandbox.k8s-test-121.septima.dk/"
	}, {
		"rel": "root",
		"type": "application/json",
		"href": "https://skraafotodistribution-stac-api-sandbox.k8s-test-121.septima.dk/"
	}, {
		"rel": "data",
		"type": "application/json",
		"href": "https://skraafotodistribution-stac-api-sandbox.k8s-test-121.septima.dk/collections"
	}, {
		"rel": "service-doc",
		"type": "text/html",
		"title": "OpenAPI docs",
		"href": "https://skraafotodistribution-stac-api-sandbox.k8s-test-121.septima.dk/docs"
	}, {
		"rel": "conformance",
		"type": "application/json",
		"title": "STAC/WFS3 conformance classes implemented by this server",
		"href": "https://skraafotodistribution-stac-api-sandbox.k8s-test-121.septima.dk/conformance"
	}, {
		"rel": "search",
		"type": "application/geo+json",
		"title": "STAC search",
		"href": "https://skraafotodistribution-stac-api-sandbox.k8s-test-121.septima.dk/search",
		"method": "GET"
	}, {
		"rel": "search",
		"type": "application/json",
		"title": "STAC search",
		"href": "https://skraafotodistribution-stac-api-sandbox.k8s-test-121.septima.dk/search",
		"method": "POST"
	}, {
		"rel": "child",
		"type": "application/json",
		"title": "2021 skråfotos",
		"href": "https://skraafotodistribution-stac-api-sandbox.k8s-test-121.septima.dk/collections/2021skraafotos"
	}, {
		"rel": "child",
		"type": "application/json",
		"title": "joplin",
		"href": "https://skraafotodistribution-stac-api-sandbox.k8s-test-121.septima.dk/collections/joplin"
	}, {
		"rel": "child",
		"type": "application/json",
		"title": "Skråfotos 2019",
		"href": "https://skraafotodistribution-stac-api-sandbox.k8s-test-121.septima.dk/collections/skraafotos2019"
	}, {
		"rel": "service-desc",
		"type": "application/vnd.oai.openapi+json;version=3.0",
		"title": "OpenAPI service description",
		"href": "https://skraafotodistribution-stac-api-sandbox.k8s-test-121.septima.dk/ogc/openapi.json"
	}],
	"stac_extensions": ["https://raw.githubusercontent.com/radiantearth/stac-api-spec/v1.0.0-beta.3/fragments/context/json-schema/schema.json"]
}

And openAPI document:

{
	"openapi": "3.0.2",
	"info": {
		"title": "FastAPI",
		"version": "0.1.0"
	},
	"paths": {
		"/": {
			"get": {
				"summary": "Landing Page",
				"description": "Endpoint.",
				"operationId": "Landing_Page__get",
				"responses": {
					"200": {
						"description": "Successful Response",
						"content": {
							"application/json": {
								"schema": {}
							}
						}
					}
				}
			}
		},
		"/conformance": {
			"get": {
				"summary": "Conformance Classes",
				"description": "Endpoint.",
				"operationId": "Conformance_Classes_conformance_get",
				"responses": {
					"200": {
						"description": "Successful Response",
						"content": {
							"application/json": {
								"schema": {}
							}
						}
					}
				}
			}
		},
		"/collections/{collectionId}/items/{itemId}": {
			"get": {
				"summary": "Get Item",
				"description": "Endpoint.",
				"operationId": "Get_Item_collections__collectionId__items__itemId__get",
				"parameters": [{
					"description": "Collection ID",
					"required": true,
					"schema": {
						"title": "Collectionid",
						"type": "string",
						"description": "Collection ID"
					},
					"name": "collectionId",
					"in": "path",
					"style": "form"
				}, {
					"description": "Item ID",
					"required": true,
					"schema": {
						"title": "Itemid",
						"type": "string",
						"description": "Item ID"
					},
					"name": "itemId",
					"in": "path",
					"style": "form"
				}],
				"responses": {
					"200": {
						"description": "Successful Response",
						"content": {
							"application/json": {
								"schema": {}
							}
						}
					},
					"422": {
						"description": "Validation Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/HTTPValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/search": {
			"get": {
				"summary": "Search",
				"description": "Endpoint.",
				"operationId": "Search_search_get",
				"parameters": [{
					"required": false,
					"schema": {
						"title": "Collections",
						"type": "string"
					},
					"name": "collections",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Ids",
						"type": "string"
					},
					"name": "ids",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Bbox",
						"type": "string"
					},
					"name": "bbox",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Datetime",
						"type": "string"
					},
					"name": "datetime",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Limit",
						"type": "integer",
						"default": 10
					},
					"name": "limit",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Filter",
						"type": "string"
					},
					"name": "filter",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Filter Lang",
						"type": "string"
					},
					"name": "filter_lang",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Filter Crs",
						"type": "string"
					},
					"name": "filter_crs",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Token",
						"type": "string"
					},
					"name": "token",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Fields",
						"type": "string"
					},
					"name": "fields",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Sortby",
						"type": "string"
					},
					"name": "sortby",
					"in": "query",
					"style": "form"
				}],
				"responses": {
					"200": {
						"description": "Successful Response",
						"content": {
							"application/json": {
								"schema": {}
							}
						}
					},
					"422": {
						"description": "Validation Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/HTTPValidationError"
								}
							}
						}
					}
				}
			},
			"post": {
				"summary": "Search",
				"description": "Endpoint.",
				"operationId": "Search_search_post",
				"requestBody": {
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/SQLAlchemySTACSearch"
							}
						}
					},
					"required": true
				},
				"responses": {
					"200": {
						"description": "Successful Response",
						"content": {
							"application/json": {
								"schema": {}
							}
						}
					},
					"422": {
						"description": "Validation Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/HTTPValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/collections": {
			"get": {
				"summary": "Get Collections",
				"description": "Endpoint.",
				"operationId": "Get_Collections_collections_get",
				"responses": {
					"200": {
						"description": "Successful Response",
						"content": {
							"application/json": {
								"schema": {}
							}
						}
					}
				}
			}
		},
		"/collections/{collectionId}": {
			"get": {
				"summary": "Get Collection",
				"description": "Endpoint.",
				"operationId": "Get_Collection_collections__collectionId__get",
				"parameters": [{
					"description": "Collection ID",
					"required": true,
					"schema": {
						"title": "Collectionid",
						"type": "string",
						"description": "Collection ID"
					},
					"name": "collectionId",
					"in": "path",
					"style": "form"
				}],
				"responses": {
					"200": {
						"description": "Successful Response",
						"content": {
							"application/json": {
								"schema": {}
							}
						}
					},
					"422": {
						"description": "Validation Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/HTTPValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/collections/{collectionId}/items": {
			"get": {
				"summary": "Get Itemcollection",
				"description": "Endpoint.",
				"operationId": "Get_ItemCollection_collections__collectionId__items_get",
				"parameters": [{
					"description": "Collection ID",
					"required": true,
					"schema": {
						"title": "Collectionid",
						"type": "string",
						"description": "Collection ID"
					},
					"name": "collectionId",
					"in": "path",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Limit",
						"type": "integer",
						"default": 10
					},
					"name": "limit",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Token",
						"type": "string"
					},
					"name": "token",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"type": "array",
						"minItems": 4,
						"maxItems": 6,
						"items": {
							"type": "number"
						}
					},
					"name": "bbox",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Bbox Crs",
						"type": "string"
					},
					"name": "bbox_crs",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Datetime",
						"type": "string"
					},
					"name": "datetime",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Crs",
						"type": "string"
					},
					"name": "crs",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Filter",
						"type": "string"
					},
					"name": "filter",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Filter Lang",
						"type": "string"
					},
					"name": "filter_lang",
					"in": "query",
					"style": "form"
				}, {
					"required": false,
					"schema": {
						"title": "Filter Crs",
						"type": "string"
					},
					"name": "filter_crs",
					"in": "query",
					"style": "form"
				}],
				"responses": {
					"200": {
						"description": "Successful Response",
						"content": {
							"application/json": {
								"schema": {}
							}
						}
					},
					"422": {
						"description": "Validation Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/HTTPValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/queryables": {
			"get": {
				"tags": ["Filter Extension"],
				"summary": "Queryables",
				"description": "Endpoint.",
				"operationId": "Queryables_queryables_get",
				"responses": {
					"200": {
						"description": "Successful Response",
						"content": {
							"application/json": {
								"schema": {}
							}
						}
					}
				}
			}
		},
		"/collections/{collectionId}/queryables": {
			"get": {
				"tags": ["Filter Extension"],
				"summary": "Collection Queryables",
				"description": "Endpoint.",
				"operationId": "Collection_Queryables_collections__collectionId__queryables_get",
				"parameters": [{
					"description": "Collection ID",
					"required": true,
					"schema": {
						"title": "Collectionid",
						"type": "string",
						"description": "Collection ID"
					},
					"name": "collectionId",
					"in": "path",
					"style": "form"
				}],
				"responses": {
					"200": {
						"description": "Successful Response",
						"content": {
							"application/json": {
								"schema": {}
							}
						}
					},
					"422": {
						"description": "Validation Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/HTTPValidationError"
								}
							}
						}
					}
				}
			}
		}
	},
	"components": {
		"schemas": {
			"HTTPValidationError": {
				"title": "HTTPValidationError",
				"type": "object",
				"properties": {
					"detail": {
						"title": "Detail",
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ValidationError"
						}
					}
				}
			},
			"ValidationError": {
				"title": "ValidationError",
				"required": ["loc", "msg", "type"],
				"type": "object",
				"properties": {
					"loc": {
						"title": "Location",
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"msg": {
						"title": "Message",
						"type": "string"
					},
					"type": {
						"title": "Error Type",
						"type": "string"
					}
				}
			}
		}
	}
}

@NicolaiLolansen
Copy link

Any update on this? @bpross-52n @dstenger

@NicolaiLolansen
Copy link

NicolaiLolansen commented Jan 26, 2022

Further testing shows that if you proxy the port to 80, such that you dont need to apply a port number, it works. It's definitely a bug then.

http://172.28.128.1 works, http://172.28.128.1:8081 does not

@dstenger
Copy link
Contributor

Thank you for providing further details.

Currently, we are working on a new release of TEAM Engine. We will work on the issues of this test suite in the second half of March (and then probably create a new release in April).
Is that fine for you?

@dstenger
Copy link
Contributor

Unfortunately, we are still not able to reproduce the problem.

Can you please provide an API we can use to reproduce the error (the one linked here is not reachable anymore)?

@NicolaiLolansen
Copy link

@dstenger this was a problem to me over a year ago, i am not working on that project anymore - i am not able to produce an API for you at this time.

@drnextgis
Copy link

I've just run into the same issue.

@dstenger
Copy link
Contributor

dstenger commented Jan 18, 2024

@drnextgis
Can you please provide further details how the reported behavior is reproducible?
Can you also provide a public API we can use to reproduce the behavior (in #125 (comment) it was confirmed that the port is the problem)?

@dstenger dstenger added this to CITE Aug 1, 2024
@dstenger dstenger moved this to Waiting in CITE Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Waiting
Development

No branches or pull requests

8 participants