Swagger UI docs 404
See original GitHub issueAPI Platform version(s) affected: 2.6
Description
Some Swagger UI docs resources like javascript and css are not loaded from the correct path which you configured in “config/routes/api_platform.yaml” resulting in a 404.
How to reproduce
- Setup an ingress blocking everything that does not start with /api/users
- configure the api_platform prefix to /api/users
- Some resources for displaying the Swagger UI don’t pass the ingress as they are coming from host/bundles
Example: expected: https://localhost:8000/api/users/public/bundles/apiplatform/swagger-ui/swagger-ui.css actual: https://localhost:8000/bundles/apiplatform/swagger-ui/swagger-ui.css The ingress is blocking https://localhost:8000/bundles/…
There should be a way to change the path from where these resources are served.
Possible Solution
I don’t know maybe serve the files for the UI from the same URL that is setup in config/routes/api_platform.yaml
This is how the swagger ui docs looks like Additional Context
most important settings of my app:
Dockerfile
FROM php:7.4-fpm
RUN apt-get update && apt-get install -y zlib1g-dev g++ git libicu-dev zip libzip-dev zip \
&& docker-php-ext-install intl opcache pdo pdo_mysql \
&& pecl install apcu \
&& docker-php-ext-enable apcu \
&& docker-php-ext-configure zip \
&& docker-php-ext-install zip
WORKDIR /app
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN curl -sS https://get.symfony.com/cli/installer | bash
RUN mv /root/.symfony/bin/symfony /usr/local/bin/symfony
#RUN symfony server:ca:install
ADD composer.json composer.lock ./
RUN composer install
ADD . .
RUN ./bin/console cache:clear
CMD ["symfony", "server:start", "--no-tls"]
k8s/ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-service
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/use-regex: 'true'
#nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
rules:
- host: ticketing.dev
http:
paths:
- path: /api/users
backend:
serviceName: user-srv
servicePort: 8000
config/routes/api_platform.yaml
api_platform:
resource: .
type: api_platform
prefix: /api/users
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Top GitHub Comments
Go to your docker and run -> bin/console asset:install 😃
I’m using Docker with PHP-8.1.9 and API Platform 3.0 and the same render on Front ! it is a new project API Platform. The symfony website work correctly but not API Platform !