0

I'm running an Apache HTTP Server on IBM i and I'm currently facing a problem accessing web services from a virtual host.

I've been playing around with the configurations of the server a while, tried lots of things, however I can't make it work. A GET-Request throws an 405 Method Not Allowed error immediately. The static content of the app stored in the sub-directory of the root directory is getting showed.

This is my httpd.conf file:

LoadModule mod_ibm_lwi /QSYS.LIB/QHTTPSVR.LIB/QLWIIHSMOD.SRVPGM
HotBackup Off
KeepAlive Off
DocumentRoot /www/server/htdocs
AddLanguage en .en
LogMaint logs/error_log 7 0
LogFormat "%h %T %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
Listen *:10123

<Location />
  Require all granted
  Header always set Access-Control-Allow-Origin "*"
  Header always set Access-Control-Allow-Methods "POST,GET,OPTIONS,DELETE,PUT"
  Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, Origin, Authorization, accept, client-security-token"
  Header always set Access-Control-Expose-Headers "Content-Security-Policy, Location"
  Header always set Access-Control-Max-Age "3600"

  RewriteEngine On
  RewriteCond %{REQUEST_METHOD} OPTIONS
  RewriteRule ^(.*)$ $1 [R=200,L]
</Location>
LoadModule was_ap20_module /QSYS.LIB/QHTTPSVR.LIB/QSVTAP24.SRVPGM
WebSpherePluginConfig /www/server/conf/ias-plugin-cfg.xml
<LwiProfile server>
  LwiAutostartOption StartEnd
</LwiProfile>
<VirtualHost app:10123>
   ServerName www.server.app.com
   DocumentRoot /www/server/htdocs/app

   <Directory /www/server/htdocs/app>
    AllowOverride None
    Require all granted

    Header always set Access-Control-Allow-Origin "*"
    Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
    Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
    Header always set Access-Control-Expose-Headers "Content-Security-Policy, Location"
    Header always set Access-Control-Max-Age "3600"

    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} OPTIONS
    RewriteRule ^(.*)$ $1 [R=200,L]

</Directory>

</VirtualHost>

<VirtualHost app-2:10123>
   ServerName www.server.app-2.com
   DocumentRoot /www/server/htdocs/app-2
</VirtualHost>
HTTPSubsystemDesc QHTTPSVR/QHTTPSVR
HTTPStartJobDesc QGPL/QDFTSVR
HTTPStartJobQueue QHTTPSVR/QZHBHTTP
HTTPRoutingData HTTPWWW

I can't simply figure it out why it's not working. Any help would be highly appreciated.

UPDATE: I've also followed the directions given in the comments below and changed the configuration multiple times, however the api still doesn't get fired.

Many thanks in advance.

BWappsAndmore
  • 491
  • 3
  • 17
  • Put your logs in the highest debug or trace available and try again. Also put your WAS plugin in debug mode, to ensure your WAS plugin is not interfering. Then post logs to the question, might help. – Nic3500 Jan 01 '22 at 02:23
  • More details regarding CORS and IHS/WAS are available here: https://www.ibm.com/support/pages/node/6348518 – Panagiotis Chavariotis Jan 02 '22 at 20:38
  • @panagiotis-chavariotis thank you so much for your reply and for sending the link. However the problem still persists. I still can't reach the api on the root folder from an app which lives in a subfolder of the same root. The static content of the app is showing. Once again, thank you for your help. – BWappsAndmore Jan 03 '22 at 09:02
  • @Nic3500 thank you so much for your reply. Could you please provide more information about how the WAS plugin can be put in debug mode? Thank you very much. Could this be somehow possible by using the HTTPAdmin Web Interface? – BWappsAndmore Jan 03 '22 at 15:28
  • 1
    FYI . . . https://www.ibm.com/support/pages/mustgather-websphere-application-server-http-plug-problems – Panagiotis Chavariotis Jan 04 '22 at 09:37

0 Answers0